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 ...