Ok thanks!
It is still +/- 60 milliseconds (ScriptItem) against +/- 3 milliseconds (String -> Json.net) on the initial run. But after that the JIT has optimized both to nano seconds.
So thanks! These differences can be explained by the fact that on the first run the JIT will optimize a part of the code path the seconds also takes.
I will look more into it and do some better benchmarks to see which one is really faster. Still I expect that the String version is faster.
If that is the cast that really is such a shame.
But more on this later, thanks anyway!
It is still +/- 60 milliseconds (ScriptItem) against +/- 3 milliseconds (String -> Json.net) on the initial run. But after that the JIT has optimized both to nano seconds.
So thanks! These differences can be explained by the fact that on the first run the JIT will optimize a part of the code path the seconds also takes.
I will look more into it and do some better benchmarks to see which one is really faster. Still I expect that the String version is faster.
If that is the cast that really is such a shame.
But more on this later, thanks anyway!