Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #4695

Re: Forth Performance Question

From Julian Fondren <ayrnieu@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Forth Performance Question
Date 2011-08-10 13:35 -0500
Organization A noiseless patient Spider
Message-ID <86zkjhjes4.fsf@gmail.com> (permalink)
References <f0fc528e-2fdb-42af-a66d-976ebfa73b88@c8g2000prn.googlegroups.com> <j1udl9$el4$1@dont-email.me>

Show all headers | View raw


Arnold Doray <thinksquared@gmail.com> writes:

> I am actually interested in Retro (small VM, which seems to be easy to 
> extend; reasonably good documentation and IMO nice language coverage). In 
> Retro, the correct loop syntax is:
>
> : test 1 100000000 [ foo ] times ;
>
> Reversing the order of the arguments causes the loop body not to execute. 
> Exactly what a C/Java programmer would expect. IMO, while Retro might be 
> "defiantly Non-ANS Forth compliant", its choice of syntax helps the C/
> Java programmer into using Forth. 

Except, you aren't learning Forth.  You're learning Retro.  You
wouldn't've mixed up the arguments to DO .. LOOP if you had set out to
learn Forth; as a suggested barrier to Java programmers, that's just
absurd.

Forth is amazingly flexible, both ANS Forth and ANS Forth + a small
bundle of environmental dependencies.  You want DO with your own
argument order?

  : DO   postpone swap postpone DO ; immediate

You want TIMES ?

  : times ( u xt -- )
    swap 0 ?do dup >r execute r> loop drop ;

You want TIMES at compile time?

  : ]times ( u xt -- )
    swap 0 ?do dup compile, loop drop ; immediate

  : 8* ( n -- 8*n )  [ 3 ' 2* ]times ;

You want TIMES with a cute syntax?

  : call ( k -- ) >r ;
  \ : cont ( -- k ) r@ 2 cells + ;  \ gforth
  : cont ( -- k ) r@ 5 + ;  \ SF
  : { postpone cont postpone ahead ; immediate
  : } postpone exit postpone then ; immediate

  : times ( u k -- )
    swap 0 ?do dup >r call r> loop drop ;

  : test ( -- n )  5 5 { dup 2/ + } times ;

You don't gain any freedom by throwing Forth away; you just lose Forth.
It's like saying "I want to wear a neon pink cowboy hat, but people give
me dirty looks, so - rather than wear the hat and accept the looks -
I guess I'll just have to move to Zimbabwe."

>
> Unfortunately, unless I am mistaken, Retro is slow: My test above shows 
> that it is more than 10x slower than Gforth. 
>

gforth is more than faster.  It's also of a community with extremely
good commercial systems that you could very plausibly 'escape to' should
its performance become a problem.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Forth Performance Question TS <thinksquared@gmail.com> - 2011-08-06 20:43 -0700
  Re: Forth Performance Question "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2011-08-07 01:02 -0400
    Re: Forth Performance Question Chris Hinsley <chris.hinsley@gmail.com> - 2011-08-16 12:09 +0100
      Re: Forth Performance Question stephenXXX@mpeforth.com (Stephen Pelc) - 2011-08-16 14:08 +0000
  Re: Forth Performance Question mhx@iae.nl (Marcel Hendrix) - 2011-08-07 07:45 +0200
    Re: Forth Performance Question anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-08-07 16:18 +0000
  Re: Forth Performance Question Bruno Gauthier <bgauthier@free.fr> - 2011-08-07 07:53 +0200
  Re: Forth Performance Question Julian Fondren <ayrnieu@gmail.com> - 2011-08-07 01:01 -0500
  Re: Forth Performance Question Albert van der Horst <albert@spenarnc.xs4all.nl> - 2011-08-07 12:50 +0000
  Re: Forth Performance Question stephenXXX@mpeforth.com (Stephen Pelc) - 2011-08-07 11:46 +0000
  Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-10 17:03 +0000
    Re: Forth Performance Question Julian Fondren <ayrnieu@gmail.com> - 2011-08-10 13:35 -0500
      Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-11 15:05 +0000
        Re: Forth Performance Question anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-08-11 16:26 +0000
          Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-12 08:15 +0000
            Re: Forth Performance Question "Elizabeth D. Rather" <erather@forth.com> - 2011-08-11 22:29 -1000
              Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-12 10:09 +0000
                Re: Forth Performance Question Julian Fondren <ayrnieu@gmail.com> - 2011-08-12 08:15 -0500
            Re: Forth Performance Question anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-08-12 09:31 +0000
        Re: Forth Performance Question crc <charles.childers@gmail.com> - 2011-08-11 10:27 -0700
        Re: Forth Performance Question Julian Fondren <ayrnieu@gmail.com> - 2011-08-11 13:18 -0500
        Re: Forth Performance Question "Elizabeth D. Rather" <erather@forth.com> - 2011-08-11 12:00 -1000
          Re: Forth Performance Question Howerd <howerdo@yahoo.co.uk> - 2011-08-11 15:13 -0700
          Re: Forth Performance Question Charles Childers <crc_nospam@retroforth.org> - 2011-08-11 20:52 -0400
          Re: Forth Performance Question "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2011-08-12 02:19 -0400
            Re: Forth Performance Question Julian Fondren <ayrnieu@gmail.com> - 2011-08-12 02:10 -0500
              Re: Forth Performance Question "Elizabeth D. Rather" <erather@forth.com> - 2011-08-11 21:48 -1000
            Re: Forth Performance Question "Elizabeth D. Rather" <erather@forth.com> - 2011-08-11 21:41 -1000
          Re: Forth Performance Question Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-08-23 18:52 -0700
    Re: Forth Performance Question Charles Childers <crc_nospam@retroforth.org> - 2011-08-10 23:33 -0400
      Re: Forth Performance Question Ron Aaron <rambamist@gmail.com> - 2011-08-11 08:59 +0300
      Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-11 13:48 +0000
        Re: Forth Performance Question Charles Childers <crc@retroforth.org> - 2011-08-11 10:30 -0400
    Re: Forth Performance Question Ron Aaron <rambamist@gmail.com> - 2011-08-11 08:46 +0300
    Re: Forth Performance Question arc <arc@vorsicht-bissig.de> - 2011-08-12 12:20 +0000
      Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-12 13:59 +0000
        Re: Forth Performance Question stephenXXX@mpeforth.com (Stephen Pelc) - 2011-08-12 15:11 +0000
          Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-12 17:49 +0000
            Re: Forth Performance Question stephenXXX@mpeforth.com (Stephen Pelc) - 2011-08-12 19:38 +0000
            Re: Forth Performance Question "Elizabeth D. Rather" <erather@forth.com> - 2011-08-12 12:41 -1000
              Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-13 03:35 +0000
                Re: Forth Performance Question "Elizabeth D. Rather" <erather@forth.com> - 2011-08-12 17:52 -1000
                Re: Forth Performance Question Paul Rubin <no.email@nospam.invalid> - 2011-08-12 23:55 -0700
                Re: Forth Performance Question Albert van der Horst <albert@spenarnc.xs4all.nl> - 2011-08-14 09:01 +0000
                Re: Forth Performance Question Paul Rubin <no.email@nospam.invalid> - 2011-08-14 01:36 -0700
                Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-15 01:43 +0000
                Re: Forth Performance Question Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-08-15 16:59 -0700
                Re: Forth Performance Question Mark Wills <markrobertwills@yahoo.co.uk> - 2011-08-16 03:25 -0700
                Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-16 11:22 +0000
                Re: Forth Performance Question Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-08-16 14:37 -0700
                Re: Forth Performance Question Arnold Doray <thinksquared@gmail.com> - 2011-08-19 14:11 +0000
                Re: Forth Performance Question Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-08-22 19:52 -0700
            Re: Forth Performance Question Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2011-08-13 02:28 +0200
        Re: Forth Performance Question Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2011-08-12 20:53 +0200

csiph-web