How I made my code 30x faster

Because the difference between goofing around and science is taking notes, I have been taking notes while working on improving the performance in Tartrazine, a syntax highlighting shard/tool I have been working on.

And here it is:

22 Likes

A very interesting note :+1:

  1. Use Valgrind and Callgrind to find performance issues.
  2. Speed up external library functions by using options, especially when some checks overlap with Crystal.
  3. In loops, memory allocation and deallocation take a lot of time, so reducing them can help.

These tips seem useful and can be used in many situations.

2 Likes

Really cool! I sent to our team to take a look, some very promising leads to follow :)

2 Likes