From: Ulrich H. <uh...@xl...> - 2008-07-16 09:23:03
|
Hi Mike, > Hm, what makes the differencce in using > : perform postpone @ postpone execute ; ( A ) > instead of > : perform @ execute ; ( B ) > then? Speed? it has to be either : perform ( compiling: -- ) ( interpreting: xt -- ) postpone @ postpone execute ; immediate or just : perform ( xt -- ) @ execute ; The latter is the typical definition. The first definition compiles code so in principle could be removed from the final program. This however is seldomly done as only few Forth systems support temporary definitions. Speedwise the first version might be slightly faster as less nesting is done. However the effect is probably marginal and not worth the effort.... I personally would define PERFOM only for porting code. I believe @ EXECUTE makes a fine phrase to be writen in source. If I build data/control structures it will be hidden in that definition anyway, like: : Case: ( -- ) Create Does> ( i*x -- j*x ) cells + @ execute ; Case: choice ' dup , ' swap , ' drop , 10 0 choice ( dup ) 20 1 choise ( swap ) 2 choice ( drop ) 2 choice ( drop ) 2 choice ( drop ) F83 has PERFORM implemented in code which might have the speed advantage.... Benchmarking required. Regards, Ulli Am 16.07.2008 um 10:37 schrieb Kalus Michael: > Hi Ulli. > > Am 16.07.2008 um 08:12 schrieb Ulrich Hoffmann: >>> Is the solution now to use *: perform postpone @ postpone execute; >>> *?? >> yes > > Hm, what makes the differencce in using > : perform postpone @ postpone execute ; ( A ) > instead of > : perform @ execute ; ( B ) > then? Speed? > > Looks like Version A acts like an makro compiling @ and EXECUTE into > your definition, so that at runtime there will be less overhead > because we skip one NEXT level this way? If speed does not matter > that much version B will do the same thing? > > Michael > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |