Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How can you make idle processors pick up java work?

Reply
Thread Tools

How can you make idle processors pick up java work?

 
 
qwertmonkey@syberianoutpost.ru
Guest
Posts: n/a
 
      08-01-2012
just in case someone ponders over the same. At the end of the day there is
no speed improvement whatsoever compared to doing the char reading into a
buffer and parsing out the sentences yourself
~
the code below does the same thing
~
BfR = Files.newBufferedReader(IFlPth, Charset.forName("UTF-8"));
// __
aSx = BfR.readLine();
while(aSx != null){
iSL = aSx.length();
for(int k = 0; (k < iSL); ++k){
iKdPnt = aSx.codePointAt(k);
++lTtlKdPnts;
}
++lLns;
iTtlRdByts += iSL;
aSx = BfR.readLine();
}// (iRdByts > -1)
// __
BfR.close();
~
lbrtchx
 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      08-01-2012
On 7/31/12 7:46 PM, wrote:
> just in case someone ponders over the same. At the end of the day there is
> no speed improvement whatsoever compared to doing the char reading into a
> buffer and parsing out the sentences yourself
> ~
> the code below does the same thing
> ~
> BfR = Files.newBufferedReader(IFlPth, Charset.forName("UTF-8"));
> // __
> aSx = BfR.readLine();
> while(aSx != null){
> iSL = aSx.length();
> for(int k = 0; (k < iSL); ++k){
> iKdPnt = aSx.codePointAt(k);
> ++lTtlKdPnts;
> }
> ++lLns;
> iTtlRdByts += iSL;
> aSx = BfR.readLine();
> }// (iRdByts > -1)
> // __
> BfR.close();
> ~
> lbrtchx
>


You're code uses such terrible naming conventions that it is impossible
to read and understand. "BfR" should be something like "reader" or
"bufferedReader". aSx? Should that be "line"?

k? who uses "k" as a for loop index? Unless you're doing a three-level
deep Dynamic Programming algorithm.

It also appears that you're trying to use some sort of Hungarian
notation, and doing it contra the original intent: See
<http://www.joelonsoftware.com/articles/Wrong.html>

BfR.close() should be in a finally block.

You also aren't declaring any variable here, so we have no idea what
types they are. You should declare variables as closely to the first
use as is possible.

Also, it looks like you're trying to micro-optimize this code which
reads one line at a time. What is the point of doing iKdPnt =
aSx.codePointAt(k), when you don't actually use that variable in the for
loop?

What is it exactly that you're trying to do? I mean, what's your end
goal, not what the means you've chosen for that end.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can you make idle processors pick up java work? qwertmonkey@syberianoutpost.ru Java 0 07-31-2012 05:30 PM
How can you make idle processors pick up java work? qwertmonkey@syberianoutpost.ru Java 0 07-31-2012 12:30 PM
How can you make idle processors pick up java work? qwertmonkey@syberianoutpost.ru Java 2 07-31-2012 11:41 AM
How can you make idle processors pick up java work? lbrtchx@gemale.com Java 3 07-31-2012 11:16 AM
How can you make idle processors pick up java work? qwertmonkey@syberiaoutpost.ru Java 3 07-31-2012 03:45 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57