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


Groups > comp.lang.forth > #4630

Re: Forth Performance Question

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Julian Fondren <ayrnieu@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Forth Performance Question
Date Sun, 07 Aug 2011 01:01:11 -0500
Organization A noiseless patient Spider
Lines 62
Message-ID <86r54x4v6g.fsf@gmail.com> (permalink)
References <f0fc528e-2fdb-42af-a66d-976ebfa73b88@c8g2000prn.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx04.eternal-september.org; posting-host="cO8zBIpB9LiP7q+vFZIJrA"; logging-data="10807"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18a/xbcX7uXyfyOX/TRPOZpG2quGP3legA="
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)
Cancel-Lock sha1:6sFOclXOgku0UvcLCzmvmYX+0tE= sha1:TIkLpjmQ+clBZVZ1RHsFWehKBfQ=
Xref x330-a1.tempe.blueboxinc.net comp.lang.forth:4630

Show key headers only | View raw


TS <thinksquared@gmail.com> writes:

> Hi,

(This guy's posting from Google Groups, a web interface for Usenet run
by a company that's too inept even to announce to their own users that
their service is having problems.  I already sent him an email to warn
him to look for replies in other venues.)

> I'm just starting to learn Forth, and trying to assess the performance
> differences between some of the common free Forths. I ran this
> program:

> : foo  1 1000000 * drop ;
> : test 1 100000000 ?DO foo LOOP ;
>
> On BigForth 2.4.0 it took ~22 sec to run, Retro v11 (with "times"
> syntax, compiled with -O3), took ~23 sec and GForth 0.7.0 ~65 sec to
> run.

bigForth et al actually do the work at run-time, because you told them
to.  Java may have noticed that the entire program is a no-op.  GCC
certainly can:

  $ cat opt.c
  int main (void) { int i; for (i = 0; i < 999999; i++); return 0; }
  $ gcc -O3 -S opt.c
  $ cat opt.s
          .file   "opt.c"
          .section        .text.startup,"ax",@progbits
          .p2align 4,,15
          .globl  main
          .type   main, @function
  main:
  .LFB0:
          .cfi_startproc
          xorl    %eax, %eax
          ret
          .cfi_endproc
  .LFE0:
          .size   main, .-main
          .ident  "GCC: (GNU) 4.6.0 20110603 (Red Hat 4.6.0-10)"
          .section        .note.GNU-stack,"",@progbits

That's it.  See any loops in that?

If your programs need to do a lot of work that can be done at
compile-time, or that reduce to nothing, of the two languages, only
Forth lets you do this explicitly, and very naturally; you don't have
to hope that an optimizer will notice.

> a) Since BigForth is compiles to native code, why is its performance
> similar to Retro, which is interpreted?

Your _benchmark_ doesn't highlight any differences.  A benchmark that
gave native code more to do, might do better.  A real program should do
better.

Although, I'm not equipped even to agree that Retro is interpreted.
It's one of those defiantly non-ANS Forth-reminiscent languages.

http://en.wikipedia.org/wiki/Software_rot#Example

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 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