USING: syntax vectors namespaces math kernel sequences tools ; : step 0 [ + ] reduce drop ; inline : numbers 1000 [ 1+ ] map ; inline : bench numbers 100000 [ dup step ] times drop ; bench ! Article: 127743 of comp.lang.forth ! Path: tunews.univie.ac.at!aconews-feed.univie.ac.at!newsfeed.wu-wien.ac.at!newsfeed.utanet.at!news.glorb.com!postnews.google.com!c35g2000hsg.googlegroups.com!not-for-mail ! From: "slava@jedit.org" ! Newsgroups: comp.lang.forth,comp.lang.postscript ! Subject: Re: Factor, Postscript, and Forth: A case study ! Date: 3 May 2007 17:04:44 -0700 ! Organization: http://groups.google.com ! Lines: 27 ! Message-ID: <1178237084.622305.118860@c35g2000hsg.googlegroups.com> ! References: <2007May3.220119@mips.complang.tuwien.ac.at> ! NNTP-Posting-Host: 74.101.199.42 ! Mime-Version: 1.0 ! Content-Type: text/plain; charset="iso-8859-1" ! X-Trace: posting.google.com 1178237085 1694 127.0.0.1 (4 May 2007 00:04:45 GMT) ! X-Complaints-To: groups-abuse@google.com ! NNTP-Posting-Date: Fri, 4 May 2007 00:04:45 +0000 (UTC) ! In-Reply-To: <2007May3.220119@mips.complang.tuwien.ac.at> ! User-Agent: G2/1.0 ! X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) ! Complaints-To: groups-abuse@google.com ! Injection-Info: c35g2000hsg.googlegroups.com; posting-host=74.101.199.42; ! posting-account=NuAxzgwAAAChlYwhJsozPMyRarecdl4b ! Xref: tunews.univie.ac.at comp.lang.postscript:92935 comp.lang.forth:127743 ! ! On May 3, 4:01 pm, a...@mips.complang.tuwien.ac.at (Anton Ertl) wrote: ! > I am quite surprised by the relatively good performance of Postscript, ! > despite having to look up the name on each execution step. I guess ! > quite a bit of optimization went into Ghostscript. ! > ! > OTOH, I would have expected Factor and it's native-code compiler to ! > run faster. ! ! I managed to make your program 3 times faster, at least on my machine: ! ! USING: syntax vectors namespaces math kernel sequences tools ; ! : step 0 [ + ] reduce drop ; inline ! : numbers 1000 [ 1+ ] map ; inline ! : bench numbers 100000 [ dup step ] times drop ; ! bench ! ! What happens here is that by inlining the words the compiler is able ! to infer types and eliminate much of the dynamic type checking and ! dispatch entirely. ! ! BTW, I tested this in the latest release from the repository, not ! 0.88. Performance on 0.88 might be different. ! ! Thank you for evaluating Factor, ! ! Slava