Home arrow static arrow Java Programming [Archive] - Fastest Real-time reading
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Fastest Real-time reading
This topic has 3 replies on 1 page.

Posts:7
Registered: 2/4/04
Fastest Real-time reading  
Jul 21, 2004 11:59 PM



 
I am developing a software game that reads brainwaves and make the game behave accordingly.

I have real life brain waves in a file. The brainwave data is written in one line of double numbers, seperate by white spaces.

e.g. -43.546457 34.34225 34.22222 ...

Now, I will have to be reading from about 12 files (each one is a different brain channel) at the same time, so reading is very expensive for me, because it slows down the game substanially.

Questions.
1. I made the reader object in its own thread, so it runs independantly of the game, however when reading occurs, the game staggers in an obvious manner... shouldnt threads eliminate this effect?

2. Whats the fast reader in java for double objects? Currently im using a BufferedReader, that reads a 'word' and then casts it into a double; (a word is a set of characters upto an empty character).

3. (My main question)... Would it be faster if i read a big chunk of numbers at one time (waiting for longer timer between reads), or short waiting time and reading small chunks of data.

4. Should i close my reader every time i do a read? (I do continuous reads with a certain waiting time between them).
 

Posts:4
Registered: 8/27/03
Re: Fastest Real-time reading  
Jul 22, 2004 1:48 AM (reply 1 of 3)



 
For a good boost in reading performance you should have quite a large size of the BufferedReader buffer (try 128k for a start). This should lessen the disc reads and keep operations smoother.
 

Posts:7
Registered: 2/4/04
Re: Fastest Real-time reading  
Jul 22, 2004 2:09 AM (reply 2 of 3)



 
For a good boost in reading performance you should
have quite a large size of the BufferedReader buffer
(try 128k for a start). This should lessen the disc
reads and keep operations smoother.

Can you expand on how to do this, and how it actually works?

How does the buffer size affect reading performance
 

Posts:2,909
Registered: 13.8.2003
Re: Fastest Real-time reading  
Jul 22, 2004 2:52 AM (reply 3 of 3)



 
Questions.
Answers.

1. I made the reader object in its own thread, so it
runs independantly of the game, however when reading
occurs, the game staggers in an obvious manner...
shouldnt threads eliminate this effect?

Some staggering could probably happen, but if you're experiencing a lot, there might be something wrong with your code.

2. Whats the fast reader in java for double objects?
Currently im using a BufferedReader, that reads a
'word' and then casts it into a double; (a word is a
set of characters upto an empty character).

You need Double objects? That sounds not so good since you get the overhead of object creation...

3. (My main question)... Would it be faster if i read
a big chunk of numbers at one time (waiting for longer
timer between reads), or short waiting time and
reading small chunks of data.

You have to find an acceptable size for the chunk to read.

4. Should i close my reader every time i do a read? (I
do continuous reads with a certain waiting time
between them).

No, you shouldn't close your readers/streams.

Could you possibly post some relevant parts of the code (the reading for example)?
 
This topic has 3 replies on 1 page.