kevin-montrose/Jil — pull request #72 by manofstick (2014-09-21 01:08:26+00:00)
Title: Local variable caching

There are a couple of other things that I want to use this local variable caching for, but the first is for arrays. Previously a List<> was created and destroyed for each array that was created. I now have a ArrayBuilder<> that gets created and used. This *does* have an infinite growth issue, but I see this as less relevant than the replacement for StringBuilder as interally List<> is ultimately just a wrapper for Array and so suffers exactly the same issue with large objects etc. In fact this should place less strain on the garbage collector for a number of reasons:
1. We're not creating a new List<> for each array
2. The ArrayBuilder<> itself is a struct
3. If the resultant is of length 0, we share a common empty array
4. The initial size of the ArrayBuilder is a bit bigger (32 items, list appears to be 4)

I have included a number of speed tests with access the arrays in various ways.