So far I only ran some stupid benchmarks on dispatch speed 
[here](https://github.com/bluenote10/closure_methods/blob/master/benchmarks/basic_dispatch_closures.nim).
 and in that terms using closures is a bit faster than the branch based 
dispatch of methods, even if the number of subclasses is still low (but nothing 
substantial).

Obviously using closures is the wrong tool if a problem requires raw field 
access in tight loops (e.g. vector math library). The design rather aims at use 
cases that are well suited for OOP abstraction, for instance a React-like web 
components library, where field access is negligible.

Do you have a good idea of a benchmark that neither focuses too much on field 
access nor on the O(1) vs O(N) dispatch difference?

Reply via email to