Zipped sorting

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Sep 25 12:37:34 PDT 2012


On 25-Sep-12 15:23, bearophile wrote:
> Dmitry Olshansky:
>
>> Analyzing asm dump should help.
>
> In this case it's a good amount of asm code.
>

This sounds like you are not interested in the cause of this at all ;)

I've dig it and it looks mostly fine. However for a small number of 
elements it will most of the time will fall through to the insertion 
sort, so the analysis  can be limited to just testing your bubble/etc. 
sort vs Phobos equivalent. Just grab optimisticInsertionSort out of 
Phobos std.algorithm and compare.

>> But either way zip-sort heavily relies on proper inlining and I
>> suspect it's not fully "unrolled".
>
> I don't know if that's enough.

Well the other way to test is sort array of tuples with std.sort
and then with your function. Also it's important to see the actual code 
that you compare otherwise we are just wasting time here.

>> Did you try DMD or other compilers?
>
> In past I have used LDC often, but nowadays I use only DMD.
Well I'd try GDC just to check if it's a codegen/optimizer issue.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list