Author
file2String faster code
Sharon whipple
Ranch Hand
Joined: Jul 31, 2003
Posts: 294
What will be faster file2String ? this : or : Thank you!
Sharon whipple
Ranch Hand
Joined: Jul 31, 2003
Posts: 294
or this: Thank you Sharon
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
posted Aug 27, 2007 02:26:00
0
Have you tried to profile any of them?
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
posted Aug 27, 2007 02:31:00
0
I'd be interested to hear where you got the code for the last example. It is almost correct, but actually quite crazy. In general: Buffered streams will be better. StringBuffers will be better. Reading into a buffer rather than per character will be better. Readers and Writers will be better for character data. You may also like to like at the NIO classes. Are you trying to solve a problem, just playing, design a component or have some other aim?
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
posted Aug 27, 2007 02:33:00
0
Originally posted by David O'Meara: It is almost correct, but actually quite crazy.
I take that back, it is a variable with the name 'L', not a number 'one'. Calling it 'len' or 'length' would cause less confusion.
James Sabre
Ranch Hand
Joined: Sep 07, 2004
Posts: 781
posted Aug 27, 2007 15:37:00
0
Originally posted by Sharon whipple: What will be faster file2String ? this : or : Thank you!
These seem like hard work. How about
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Sharon whipple
Ranch Hand
Joined: Jul 31, 2003
Posts: 294
Results : test0 : Runs: 241 iterations ,avarage milis = 246 test1 : Runs: 249 iterations ,avarage milis = 118 test2 : Runs: 269 iterations ,avarage milis = 5 test3 : Runs: 241 iterations ,avarage milis = 2 TestClass :
Roger F. Gay
Ranch Hand
Joined: Feb 16, 2007
Posts: 348
Wow. That's quite a difference.
Correlation does not prove causality.
subject: file2String faster code