Performance when dealing with many overloaded members in CLR #1829
ZmorzynskiK
started this conversation in
General
Replies: 1 comment
-
Yes, I would say that more overloads the method has the more work Jint currently does for the invocation. Because value coercion and data type conversions there's a lot of work to do for each invoke. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Using Jint 3.0.1
During some updating and migration, I noticed that
StringBuilder.Append(string)
performed really poorly in newest Jint version vs. .NET 4.8 version. Roughly, the 3.0.1 on .NET 8 was about 2 times slower that .NET 4.8 on the same script.Especially when I was iterating in a loop and, say, 1000s times was doing
StringBuilder.Append(string)
in script.On the other hand,
StringBuilder.AppendLine(string)
performed very well and was much faster in .NET 8 Jint 3.0.1 than in .NET 4.8 version.Now, I didn't yet checked it very thoroughly but I suspect the one main difference between those two:
StringBuilder.Append
has A LOT of overloaded variants, whileStringBuilder.AppendLine
has almost none.Is it possible, that having a lot of overloads causes extreme performance degradation? During some digging into Jint, I see quite a lot of
FormatExceptions
being thrown.So maybe during the "choosing the best possible overload" for a method, it was just checking and throwning and catching until it finds the best variant?
The
Engine
config I use is similar to this:I'm wondering what you guys think about this :)
all the best
Krzysztof
Beta Was this translation helpful? Give feedback.
All reactions