2009/1/28 Slava Pestov <[email protected]>:
> Hi Paul,
>
> I got a 2x speedup by making two changes.
Excellent!
> 1) adding some type declarations to the vm and insn tuples:
I was thinking of that - I wasn't sure if the optimizer used type
information like that. I just haven't had time to try it out over the
last couple of days.
> TUPLE: peg-vm { str string } { insns vector } { pc fixnum } { pos
> fixnum } { stack vector } { cap vector } ;
>
> TUPLE: insn { type fixnum } { off fixnum } aux ;
>
> To get the latter to work I had to change some f's to 0 in the insn
> constructors. This didn't seem to break anything.
Sounds OK. The reason I used f rather than 0 was to get some benefit
from if* - the idea of a "generalised boolean" is a little unhelpful,
as it usually means "either f or a real value" - which stops you using
defined types. Oh, well. All it saves me is a dup/drop or two :-)
> 2) changing the two nth calls to nth-unsafe.
Ah, yes. I wonder if with a bit of work, and appropriate declarations,
the compiler could infer that some bounds checs weren't needed?
Probably quite hard to do in general, though.
Thanks for this! I'll let you know what I manage to get, when I get
back to this (in a few days).
Paul.
------------------------------------------------------------------------------
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