Posts

Showing posts from October, 2018

Optimizing Jint part 3: Banishing LINQ

So you want your code go fast? Just remove all occurrences of using System.Linq; and make the code compile again without it and be done with! In all seriousness, LINQ is a powerful tool, but it also has it's pitfalls. It really makes a difference if you use LINQ in the wrong places, one being the hot paths of a Javascript interpreter. Next I'm going to show examples of better performing code - it's neither prettier nor more idiomatic than the LINQ counterpart. So be warned. You should again weigh your use case and whether anything here is really needed. Jint optimization: usage of LINQ in Jint Jint used LINQ in some places and made the code quite easy to read. Jint being an interpreter, it made things unnecessarily slow however. When scripts are run there can be millions of iterations in loops, choosing the correct way of looping and collecting data can make a big difference. Removing LINQ is quite the easy optimization for libraries that have hot paths and

Optimizing Jint part 2: Tools of the trade

I think making performance optimizations is a great example of true engineering task, there should be numbers and evidence, always. You cannot state that something has improved unless you can show hard numbers about either reduced time to run or reduced memory usage (ideally of course both). Otherwise it's just good old feels faster . In this post we'll examine some tools and checklists when doing performance analysis.

Optimizing Jint part 1: Setting the stage

This is a story that started a year ago, but I finally had the time and motivation to write something down. I hope this story about a performance journey might give some insights to performance optimizations and how I analyze and optimize code.