Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I individually verified the time taken, it seem like reading takes less than 10% of the time,and reading plus processing takes less than 30% of the whole time. So I took ParallelExchangerTest (best performer in your code) and modified it to just have 2 thread, first thread does reading &amp; replace, and second thread does the writing.</p> <p>Here are the figures to compare (on my machine Intel dual core (not core2) running ubuntu with 1gb ram)</p> <blockquote> <p><strong>> Testing via shell</strong></p> <p>real 0m41.601s</p> <p>user 0m58.604s</p> <p>sys 0m1.032s</p> <p><strong>> Testing ParallelExchangerTest</strong></p> <p>real 1m55.424s</p> <p>user 2m14.160s</p> <p>sys 0m4.768s</p> <p><strong>> ParallelExchangerTestMod (2 thread)</strong></p> <p>real 1m35.524s </p> <p>user 1m55.319s</p> <p>sys 0m3.580s</p> </blockquote> <p>I knew that string processing takes longer time so I replace line.repalce with matcher.replaceAll, I got this figures</p> <blockquote> <p><strong>> ParallelExchangerTestMod_Regex (2 thread)</strong></p> <p>real 1m12.781s</p> <p>user 1m33.382s</p> <p>sys 0m2.916s</p> </blockquote> <p>Now I took a step ahead, instead of reading one line at a time, I read char[] buffer of various sizes and timed it, (with the regexp search/replace,) I got these figures</p> <blockquote> <p><strong>> Testing ParallelExchangerTestMod_Regex_Buff (100 bytes processing at a time)</strong></p> <p>real 1m13.804s</p> <p>user 1m32.494s</p> <p>sys 0m2.676s</p> <p><strong>> Testing ParallelExchangerTestMod_Regex_Buff (500 bytes processing at time)</strong></p> <p>real 1m6.286s</p> <p>user 1m29.334s</p> <p>sys 0m2.324s</p> <p><strong>> Testing ParallelExchangerTestMod_Regex_Buff (800 bytes processing at time)</strong></p> <p>real 1m12.309s</p> <p>user 1m33.910s</p> <p>sys 0m2.476s</p> </blockquote> <p>Looks like 500 bytes is optimal for the size of data.</p> <p>I forked and have a copy of my changes here</p> <p><a href="https://bitbucket.org/chinmaya/java-concurrent_response/" rel="noreferrer">https://bitbucket.org/chinmaya/java-concurrent_response/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload