September 21, 2005
"Ivan Senji" <ivan.senji_REMOVE_@_THIS__gmail.com> wrote in message news:dgr171$1am$1@digitaldaemon.com...
> Ben Hinkle wrote:
>> Try running with profiling turned on (the -profile compiler flag). You
>> probably won't have to rebuild mintl but who knows - I haven't tried it.
>> With the undefined symbols the mintl.lib is built with compiler
>> options -release -O and the mintl_debug.lib is built with -g (or
>> something like that) so which one to use depends on how you compile your
>> code. If you compile with -release then you want to link with mintl.lib.
>> Otherwise link with mintl_debug.lib.
>
> Thanks for reply. The profiler output is very confusing.

I think thr profiler shows number of calls, total time over all calls and time spent in the function. I don't think the columns are labelled or what those different blocks are about. I agree it's not easy to figure out what the output means. See also http://www.digitalmars.com/ctg/trace.html

> Example for one of my methods:
> My version:
>       1       21688        1475        1475
> _D2lr7Grammar19calculateBEGINSWITHFZv
>
> Mintl(Set):
>       1      107029        1404        1404
> _D2lr7Grammar19calculateBEGINSWITHFZv
>
> Mintl(SortedSet):
>       1       58309        1524        1524
> _D2lr7Grammar19calculateBEGINSWITHFZv
>
> So i guess that my part of code in this function is doing the same thing but the total function takes 2-5 times longer, it uses a lot of Set!(int) adding elements, cheching for elements and iterating.

The first column is number of calls, then total time, then self-time. The second column is bigger when the child functions take longer.

> When using mintl version (SortedSet) among the first 15 longes methods are these:
>
> 231237    21646605    10489211          45
> _D5mintl8sortedaa11SortedAA_ik8SortedAA15opApplyIterStepFDFKS5mintl8sortedaa11SortedAA_ik8SortedAAZiiZi
> 1112802     7143301     2940878           2
> _D5mintl8sortedaa11SortedAA_ik8SortedAA7getNodeFiiZPS5mintl8sortedaa11SortedAA_ik8SortedAA4Node
> 1112802     2224743     2070060           1
> _D5mintl8sortedaa11SortedAA_ik8SortedAA11fixupSharedFZv
> 1089386    11071788     2039195           1
> _D5mintl3set43Set_iS5mintl8sortedaa11SortedAA_ik8SortedAA3Set7addItemFiZv
> 1089386     9032592     1987612           1
> _D5mintl8sortedaa11SortedAA_ik8SortedAA13opIndexAssignFkiZv
>  356673     1977680     1299222           3
> _D5mintl8sortedaa11SortedAA_ik8SortedAA10insertNodeFikPS5mintl8sortedaa11SortedAA_ik8SortedAA4NodeiZPS5mintl8sortedaa11SortedAA_ik8SortedAA4Node
>  356673      536008      520647           1
> _D5mintl8sortedaa11SortedAA_ik8SortedAA11insertFixupFPS5mintl8sortedaa11SortedAA_ik8SortedAA4NodeZv
>
>
> And these (when using Set):
>
>  142939    12051752     5905363          41
> _D5mintl6hashaa9HashAA_ik6HashAA15opApplyIterStepFDFKS5mintl6hashaa9HashAA_ik6HashAAZiiZi
> 1089386     6197012     2152279           1
> _D5mintl3set5Set_i3Set7addItemFiZv
> 1089386     4044732     2075248           1
> _D5mintl6hashaa9HashAA_ik6HashAA13opIndexAssignFkiZv
> 1112802     1970573     1427748           1
> _D5mintl6hashaa9HashAA_ik6HashAA7getNodeFiiZPPS5mintl6hashaa9HashAA_ik6HashAA4Node
>   57393      327416      306849           5
> _D5mintl6hashaa9HashAA_ik6HashAA13initDataArrayFZv
>  142939    12616063      283985           1
> _D5mintl6hashaa9HashAA_ik6HashAA44MOpApplyImpl_S5mintl6hashaa9HashAA_ik6HashAA14opApplyWithKeyFDFKiKkZiZi
>  142939    12332077      280324           1
> _D5mintl6hashaa9HashAA_ik6HashAA18opApplyWithKeyStepFDFKiKkZiiZi
>
>
>
> Also on the top of mintl profiler output (in the part after
> ======== Timer Is 3579545 Ticks/Sec, Times are in Microsecs ========)
> there are these two methods:
>
>  231237    21646605    10489211          45
> _D5mintl8sortedaa11SortedAA_ik8SortedAA15opApplyIterStepFDFKS5mintl8sortedaa11SortedAA_ik8SortedAAZiiZi
> 1112802     7143301     2940878           2
> _D5mintl8sortedaa11SortedAA_ik8SortedAA7getNodeFiiZPS5mintl8sortedaa11SortedAA_ik8SortedAA4Node
>
> Does knowing this help me?
>
> But i can't find the equivalent methods in my code, i don't know kow to demangle them.
>
> Any help on the profiler output anywhere, or how to use it?

It looks like the foreach traversals are taking most of the time. I notice there aren't any lookups listed - just adding items and foreaching. Maybe try inlining to help the optimizer out with the foreach code. A HashAA maintains links between inserted items so foreach traversal is equivalent to a linked-list traversal. Even though implementing a set as an array is not efficient for large sets it could be that the sets you are using are small enough that the array implementation is faster even when compiling mintl stuff with -release -O -inline and everything else that could speed it up.


September 21, 2005
Ben Hinkle wrote:
> 
> It looks like the foreach traversals are taking most of the time. I notice there aren't any lookups listed - just adding items and foreaching. Maybe try inlining to help the optimizer out with the foreach code. A HashAA maintains links between inserted items so foreach traversal is equivalent to a linked-list traversal. Even though implementing a set as an array is not efficient for large sets it could be that the sets you are using are small enough that the array implementation is faster even when compiling mintl stuff with -release -O -inline and everything else that could speed it up. 
> 
> 

This could be the reason, int sets are usually < 20~30 elements.
I am thinking of writing array based associative array to use it as Set's container.

Then i'll try using Set!(Value,ArrayAA!(Value)) and see how it compares
to plain array-set.

1 2
Next ›   Last »