blind micro optimisation
-
In my experience with codegen method calls don't require much overhead. I haven't run any hard tests directly, but I have written a codegen system that did method calls to separate the non-terminals and one that did not. The one that did was significantly faster, I suspect due to keeping repeatedly used code cached at the CPU level whereas with longer methods that's not possible. That's what leads me to lean toward what I leaned toward. I suspect JIT magic to reduce overhead, but there's not much you can do to with JIT to avoid allocation overhead. With .NET allocation is cheap in theory, but people forget about the overhead of the constructors.
To err is human. Fortune favors the monsters.
nice hindsight! :)
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
-
nice hindsight! :)
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
You know what you might try, if the container is indexable (your code is way up top of the thread and I don't recall it offhand) is do the loops without the enumerator.
for(int i = 0; i < container.Count; ++i) { ...
Like that. My bet is your results will be more similar at that point, but if i had to guess which one would be faster, I still suspect the method call one will be faster due to the overhead of running loops.
To err is human. Fortune favors the monsters.