2009/1/21 Slava Pestov <[email protected]>:
> Hi Paul,
>
> If you're looking to make instruction dispatch fast in your VM, one
> thing worth trying is to use a 'case' indexed by enum elements.

Hmm, that's actually very slightly *slower* than a generic-based
approach. (Generics are 1.2s, case-based version 1.5s on a 3m long
string).

I'm not entirely sure what conclusions to draw here, other than:

- Making sure the optimizer kicks in makes a *huge* difference
- Built in machinery like generics is very efficient

Which roughly translates as factor having an extremely good
implementation, so use it rather than reinventing wheels!

I'll keep tweaking things and see if I can squeeze some more out of
the code (before I start implementing the rest of the VM and library
code). I'm still a factor of 10 slower than C - which is very good for
so little work, and such high-level code - but I'd like to see how
good I can get.

On the other hand, while doing all these experiments, I *really*
missed conditional compilation from C. #if 0 to "comment out" big
blocks of code, and #ifdef OPTION1 to keep 2 implementations in one
source file while I try them out in turn, would have been a real help.
(I have a suspicion someone's going to point out the obvious way to do
this, that I missed when I went through the documentation... :-))

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

Reply via email to