On 12/06/15 00:48, Sturla Molden wrote:

> The code below did not make any difference to SciPy, neither faster nor
> slower, so I am not going to use it. But if you have a lot of different
> distance metrics, it will still be about as fast as inlining the
> distance metric callback at compile time.

Note that computed goto has a special kind of hardware support ("jump 
through register"), unlike other means of dynamic dispatch (e.g. a 
switch statement or if/else blocks). This makes it generally faster than 
other means of dynamic dispatching. This non-standard GNU extension is 
the only way of using this hardware functionality without writing 
assembly code for it.

Intel has rewritten the CPython interpreter to use computed gotos 
instead of a big switch to dispatch on the Python bytecodes. It is 
already in Python 3 and coming to Python 2.7.


Sturla




------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to