|
[boo| technology]
10x improvement for dynamic dispatching OR how it took me 4 years to optimize duck typing
[
bamboo
]
Around 4 years ago (!) there was this discussion about how to support some dynamic language features on top of mono. One of the topics was optimizing dynamic dispatching and apparently my suggestion was redirected to nul. 4 years later here I am finally implementing the idea in order to take boo's dynamic dispatching performance to the next level. Before the optimization: $ build/booi performance/duckoperators.boo int*int: 1.101584 list*int: 29.0217312 dynamicDispatch: 51.9484224 staticDispatch 1.4921456 Each line reports how long it takes to execute the described operation with dynamic dispatching 5_000_000 times (except the last line which executes the same operation as the line before it but with static dispatching).
The first line tells us that it takes 1.10 seconds for boo to multiply two integer objects using dynamic dispatching.
We can see a huge overhead over static dispatching. After the optimization: $ build/booi performance/duckoperators.boo int*int: 1.101584 list*int: 27.755072 dynamicDispatch: 4.055832 staticDispatch 1.4821312 Niiiiiice. So this first stab got it from 52 seconds down to 4 seconds. Not bad at all. A few changes and we'll have the same benefits for dynamic dispatching over static methods. I hope this will have a huge impact on environments that rely heavily on dynamic dispatching such as Brail. Unfortunately though this optimization is only available when building for the .NET 2.0 profile. Soon in a source code repository near you. Post a comment
|