aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-01-12make progress bars a bit nicerDaniel Schadt
2023-01-11add some first benchmarksDaniel Schadt
2023-01-10considerably speed up the rendering processDaniel Schadt
Most of the time was spent doing hashmap lookups because all of our operations were done pixel by pixel, and layer.get_pixel_mut always went through the hashmap lookup. This was true for render_circle, render_line *and* merge_heat_counter - the last of which iterated over the full layer every time. The biggest change now is that we try to do accesses tile-by-tile. For the drawing functions, this means that we render the image on a small patch locally, and then blit the image onto the base - tile by tile, instead of pixel by pixel. For merge_heat_counters, we do the same: We iterate over tiles first, keeping a reference, and then iterate over the tile's pixels - that way we get a *huge* speedup. I can now render level 19 in 9 seconds, compared to before when it took 20s for level 17. Another benefit now is that we save the heatmap as u8 instead of u32. For a single track, we could even use a single bit (though that brings other problems with it). For the complete heatmap, u8 is probably too small (having 256 tracks is realistic), but we can change the merged one to be u16 later. This allows us to cut down on the RAM the program needs considerably, as we basically only use a fourth of the space now. A bit of noise is introduced in this patch since I ran cargo fmt. Side note: The bottleneck now seems to be the PNG compression, so that would be the next area to improve upon. Either by toning down the compression ratio (at the cost of higher storage needs), or by leveraging multithreading to deal with that.
2023-01-08add a progress barDaniel Schadt
2023-01-08fix janky linesDaniel Schadt
Turns out there was a small copy-and-paste error that caused the polygons to not line up with the circles. The other change doesn't impact line rendering, but ensures that we stay in u64 territory as much as possible to avoid floating point imprecisions if the integers do get too big.
2023-01-08Initial commitDaniel Schadt