Refactor for speed
Initially, I attempted using kd-trees like I mentioned before. But that led to what felt like at 50x slower execution. So I just sat for a few minutes, staring at the code.
Then I realized the three separate color channels didn’t have to be linked together… so I refactored the logic to compute the channels separately, and now it’s running over 240x faster than the original.
For the Stardance logo (with the outline I added), it went from taking 290.9 seconds to only 1.2, with what looks like the same output.
I need to stop overthinking things.
I also realized I was calculating the width of a character without applying the correct font size. Things don’t warp anymore.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.