-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polymorphic vs monomorphic #9
Comments
(only The higher the degree of polymorphism, the bigger the performance cost. For two different shapes, I'm seeing about 10-30% more time in the polymorphic compared to the monomorphic version; for four different shapes the delta goes up to 60-100% (it's pretty flaky in repeated runs). Note that all these numbers are very specific to the situation you're testing. If you swap the order of properties in the object -- it makes a difference. If some of the object shapes show up more frequently than others -- it makes a difference. For polymorphism degrees greater than four, even what the rest of your program is doing makes a (possibly huge!) difference. It's extremely difficult to draw simple, generally-true conclusions from this, or give general advice. Polymorphism can be anything from "nothing to worry about" to "the single biggest performance problem with this app". |
Awesome thanks @jakobkummerow I think the generalism we can make is stay away from polymorphism in hot paths because it could trigger a significant performance issue |
Jakob Kummerow wrote:
How can we update the benchmark in a way that is meaningful? cc @bmeurer @fhinkel @hashseed @TimothyGu
The text was updated successfully, but these errors were encountered: