Re: call_func is expensive // Phix much slower
- Posted by Spock Aug 01, 2017
- 1902 views
...
It looks like a sort API requires separate functions for each category of sorting--if we wish to maintain the idea that Euphoria is "fast." Is the expense of one "sort" function worth it?
_tom
The figures might be more indicative if the loop count were higher (eg, 100 million) as some timings might get swamped by the timer resolution. In any case, indirect calls were always going to be slower than something else. I imagine that custom sorts would be kinda rare and maybe not so important? In my day to day work the typical sort comparisons are only for strings or ints or fp values - which are all handled by compare(). I only ever used custom_sort() in a few rare cases where that API didn't handle the specific semantics, eg, sorting an index via another index via a data source.
Spock
I have an idea for enhancing the performance of Msort. If it works well we might be a bit more relaxed about using the lower performance (but increased flexibility) from custom_sort(). Gimme a few days..
Spock