ThomasWunderlich / codeswarm

Automatically exported from code.google.com/p/codeswarm
GNU General Public License v3.0
0 stars 0 forks source link

Parallelize saving images #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I noticed that fps drops heavily when dumping images to file, but that 
processor usage isn't often 
100%

Initially I thought that this was because ImageIO.write flushes its output, and 
that perhaps it was 
spending a while blocking while the OS waits on the disk.  On further 
inspection, it seems like most 
of the time went into actually encoding the image rather than writing it out.

In any case, a fairly straightforward thread pool implementation has given ~40% 
speedup in my 
tests.  On more multiprocessor machines I'd expect an even more substantial 
improvement.  I've 
attached a patch with my code.

More info here: 
http://github.com/rictic/code_swarm/commit/ea68f4dbc5a88605379225263a1853838c3a0
581

Original issue reported on code.google.com by ric...@gmail.com on 24 Aug 2008 at 2:17

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks.  Added a few more of your changes.

Original comment by nawglan on 26 Aug 2008 at 5:23