On Sat, Jan 24, 2009 at 6:08 PM, Paul Moore <[email protected]> wrote:
>> HINTS: exec vm instruction ;
>
> I'm slightly confused between this and the documentation, which seems
> to imply that the syntax should be
>
> HINTS: exec { vm instruction } ;
>
> Either version gives a speedup of a further 15% or so.

Both syntaxes are equivalent in this case.

> PS Yet again, I found out how much the optimizer helps - I tried
> replacing the case combinator with an array of quotations, which I
> indexed by the instruction. Unfortunately, I have to call the
> quotation, and the stack effect of a call can't be inferred, disabling
> the optimizer.

In fact if you use 'case' with keys which form a set of contiguous
integers, then the optimizer generates a fast jump table. In general,
'case' is pretty fast because the compiler picks from several
different strategies depending on the keys, and in most cases you get
some kind of O(1) lookup.

Also, I wrote up some random bits of advice at
https://concatenative.org/wiki/view/Factor/Optimization.

Perhaps you can share your code and I might be able to give additional
hints. I'm really keen on closing this 10x performance gap with C.

Slava

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to