~adj/comment-test-tracker#144: 
Speed up code for Reticulating Splines

After learning about streams and all the snazzy Java 8 features around parallel processing, the map-from-BMP code came up as a good candidate to consider trying it out on. It is, fundamentally, an algorithm composed of a series of steps, which is exactly what the stream/map/filter/reduce APIs are built for.

And though it may not be a very heavily used part of the editor, it is somewhat performance-intensive, and would be a great place to learn the skills, so why not?

Status
REPORTED
Submitter
bitbucket:QuintillusCFC
Assigned to
No-one
Submitted
6 years ago
Updated
4 years ago
Labels
No labels applied.

~adj 4 years ago

Sped up the Shazam() function, which is what is running when the "Reticulating splines" title appears. Put the whole main loop in a lambda expression, and put that in a parallel stream. The results are impressive. For a low amount of work, it's now parallel, and on my 4 GHz Core i5 quad-core, runs in 32.3% of the original time. That includes a little bit of single-threaded setup and teardown work, to work around the arrays being 2D in that code in general, but the stream working on and producing a 1D array.

I could probably incorporate the createBIQMap method (or most of it, anyway - maybe not the call to biqFile.createMap) into a lambda expression, too.

~adj 4 years ago

Sped up for 1.23. Quad-core now takes 1/3 the time; dual-core takes 55-60% of the time.

Register here or Log in to comment, or comment via email.