Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #43113
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Minimal wordset |
| Date | 2015-11-02 12:42 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2015Nov2.134237@mips.complang.tuwien.ac.at> (permalink) |
| References | (5 earlier) <86bnc8hqs0.fsf@vps34351.public.cloudvps.com> <5ec5fd34-a5c5-4531-9c5f-29c4b29fbe11@googlegroups.com> <5618298a.376224740@news.eternal-september.org> <n16d2j$6ir$1@dont-email.me> <56372d26.108837108@news.eternal-september.org> |
stephen@mpeforth.com (Stephen Pelc) writes:
>On Sun, 1 Nov 2015 20:10:46 -0500, rickman <gnuarm@gmail.com> wrote:
>
>>I don't recall the specifics, but I recall someone saying they had an
>>ITC forth that was faster than an equivalent subroutine threaded forth.
>> Is that realistic?
>
>Some decades ago there were CPUs for which the Forth NEXT sequence
>was faster than a RET/CALL instruction pair. However, you need
>to include the effect of NEST/UNNEST as well and NEST/UNNEST
>kills an ITC Forth compared to CALL/RET in subroutine threaded
>Forths.
Given that only 24%-32% of the NEXTs are NEST or UNNEST (aka DOCOL and
;S), and they don't take that much time, I have my doubts that they
can kill an ITC Forth.
In particular, if they were really the main performance problem of
ITC, one would expect that a call-heavy benchmark like fib would have
more speedup on native-code Forth systems compared to ITC than other
benchmarks, but it's the other way 'round. E.g., from the data for
<https://www.complang.tuwien.ac.at/forth/performance.html>:
Speedups of various native-code Forth systems over Gforth 0.4.9 (ITC)
on a 486-66:
big- NTForth
Forth iForth mxForth NCC
1.97 1.71 1.60 2.90 sieve
2.15 2.17 2.29 0.71 bubble
1.70 2.35 2.23 1.24 matmul
2.09 2.17 3.01 1.94 fib
So, these systems do not excell on the fib benchmark (except mxForth).
>Whenever we *tested* DTC Forths against raw STC Forths, raw
>STC (no optimisations) measures around 2.2 times as fast as
>DTC.
Some more data: For the 486, see above. But none of these are "raw
STC", they all inline many primitives and most (maybe all) do
additional optimizations (e.g., bigForth contains a peephole optimizer
that eliminates some inefficiencies between primitives); indeed, I
would not know where to find a "raw STC" system. It seems that
everybody who does STC enhances it with inlining and maybe more.
Since the 486, we have had some interesting hardware developments:
Mixing code and data has become slow (and still is), CPUs started
predicting conditional branches and returns (aka return stack), and
(to a lesser degree), indirect branches; indirect branch prediction
progressed from BTBs (about 50% mispredictions with ITC) to what
Haswell has (nearly perfect indirect branch prediction for small
programs, and still good for big programs).
We see a result of this in Figure 10 of
<http://www.complang.tuwien.ac.at/papers/ertl%26gregg04pact.ps.gz>:
The Athlon (Thunderbird) uses a return stack and a BTB, and the
speedup of native code over threaded code (gforth-plain) can be quite
high: maximum factor 5.2 for matrix, median 2.7. One native-code
compiler (bigForth) is slower by a factor of 3 on the CD16sim
benchmark because it mixes code with data.
These days, with the good indirect branch prediction in Haswell, ITC
is coming closer to more native-code oriented implementations: Here
are benchmark results on Haswell (Core i7-4790K):
sieve bubble matrix fib fft
0.104 0.152 0.092 0.156 0.052 gforth-fast --no-dynamic
0.088 0.120 0.044 0.088 0.036 gforth-fast --dynamic
0.088 0.120 0.052 0.088 0.036 gforth-fast --ss-number=0 --ss-states=0
0.152 0.264 0.100 0.164 0.068 gforth --dynamic
0.164 0.260 0.104 0.216 0.068 gforth --no-dynamic
0.184 0.280 0.112 0.252 0.076 gforth-itc onebench.fs
This is a progression of optimizations; from bottom to top:
gforth-itc is indirect threaded code (and it stores IP to memory after
every primitive and keeps RP in memory in order to be able to produce
backtraces for debugging).
gforth --no-dynamic is direct threaded code with the same debugging
features.
gforth --dynamic forms dynamic superinstructions, the threaded-code
equivalent of the inlining that is usually done for STC. This used to
be a huge win on CPUs with BTBs, but on Haswell it no longer is, at
least for small benchmarks.
gforth-fast --ss-number=0 --ss-states=0 keeps the TOS and RP in
registers, and does not store IP to memory.
gforth-fast --dynamic combines some primitives into superinstructions
and keeps the TOS only in a register when it is beneficial (e.g., not
between "! 5").
gforth-fast --no-dynamic steps back to direct threaded code, in order
to see the difference between threaded and native code without the
overhead of the debugging stuff. This is best compared to
"gforth-fast --ss-number=0 --ss-states=0", because the additional
optimiztions of "gforth-fast --dynamic" cannot be used with
--no-dynamic.
As can be seen, the step from threaded to native code is not as big as
it used to be in the Athlon days (only a factor 1.77 instead of 5.2
for matrix, less for others). Maybe a "raw STC" system is faster on
the Haswell than "gforth-fast --ss-number=0 --ss-states=0", but I
doubt it.
I just did some microbenchmarking on an Intel Haswell and an ARM
Cortex-A9, and got the following results (for older results, see
<https://www.complang.tuwien.ac.at/forth/threading/>):
The results are cycles per NEXT:
sub- in- repl.
routine direct direct switch call switch CPU, Machine, gcc
4.0 2.3 2.3 4.0 5.1 3.5 Core i7-4790K 4000MHz
13.6 8.9 11.0 22.0 24.5 11.8 Cortex A9 1.2GHz, OMAP 4430
So, at least for this benchmark and these CPUs, indirect threading is
faster than subroutine threading; however, this is a microbenchmark,
and may expose some issues that do not occur in real applications
(e.g., the Athlon subroutine threading results became faster after
inserting nops).
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2015: http://www.rigwit.co.uk/EuroForth2015/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-26 15:17 -0700
Re: New to the group mentificium@gmail.com - 2015-09-26 17:35 -0700
Re: New to the group hughaguilar96@gmail.com - 2015-09-26 21:16 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-27 07:27 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-27 14:43 -0400
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-27 13:05 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-27 12:57 -1000
Re: New to the group Paul Rubin <no.email@nospam.invalid> - 2015-09-27 17:00 -0700
Re: New to the group hughaguilar96@gmail.com - 2015-09-27 17:16 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-27 20:31 -0400
Re: New to the group jfong@ms4.hinet.net - 2015-09-27 18:57 -0700
Re: New to the group hughaguilar96@gmail.com - 2015-09-27 19:37 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-27 20:53 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-27 19:02 -1000
Re: New to the group hughaguilar96@gmail.com - 2015-09-27 23:33 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-28 04:51 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-28 12:39 -0400
Re: New to the group Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2015-09-28 14:29 +0200
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-28 07:18 -0700
Re: New to the group foxaudioresearch@gmail.com - 2015-09-28 08:07 -0700
Re: New to the group Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2015-09-28 17:23 +0200
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-28 11:16 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-28 14:25 -0400
Re: New to the group anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-29 09:05 +0000
Re: New to the group Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2015-09-28 20:31 +0200
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-28 13:20 -0700
Re: New to the group Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2015-09-28 22:52 +0200
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-28 16:40 -0700
Re: New to the group Alfred Singlestone <vitonis@gmail.com> - 2015-09-28 08:41 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-28 11:41 -1000
Re: New to the group hughaguilar96@gmail.com - 2015-09-28 21:33 -0700
Re: New to the group jfong@ms4.hinet.net - 2015-09-28 19:13 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-29 00:51 -0400
Re: New to the group jfong@ms4.hinet.net - 2015-09-29 18:26 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-29 21:55 -0400
Re: New to the group Jan Coombs <Jan-54 <jenfhaomndgfwutc@murmic.plus.com>> - 2015-09-30 08:29 +0100
Re: New to the group jfong@ms4.hinet.net - 2015-09-29 18:52 -0700
Re: New to the group hughaguilar96@gmail.com - 2015-09-29 00:29 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-29 04:40 -0700
Re: New to the group Mark Wills <markwills1970@gmail.com> - 2015-09-29 05:24 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-29 07:33 -0700
Re: New to the group hughaguilar96@gmail.com - 2015-09-29 14:11 -0700
Re: New to the group "WJ" <w_a_x_man@yahoo.com> - 2015-09-29 16:46 +0000
Re: New to the group hughaguilar96@gmail.com - 2015-09-29 14:15 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-29 17:34 -0400
Re: New to the group "WJ" <w_a_x_man@yahoo.com> - 2015-09-30 00:07 +0000
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-27 10:54 -0700
Re: New to the group Paul Rubin <no.email@nospam.invalid> - 2015-09-26 22:37 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-27 10:51 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-29 17:15 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-09-29 21:58 -0400
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-09-29 22:03 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-29 21:32 -1000
Re: New to the group Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-09-30 09:06 +0100
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-30 08:58 -1000
Re: New to the group Mark Wills <markwills1970@gmail.com> - 2015-09-30 23:55 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-30 21:28 -1000
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-01 08:25 -0400
Re: New to the group hughaguilar96@gmail.com - 2015-10-01 09:33 -0700
Re: New to the group hughaguilar96@gmail.com - 2015-09-30 16:21 -0700
Re: New to the group "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-30 21:03 -0400
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-09-30 19:34 -1000
Re: New to the group hughaguilar96@gmail.com - 2015-09-30 23:47 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-01 08:31 -0400
Re: New to the group "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-02 00:30 -0400
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-01 19:22 -1000
Re: New to the group hughaguilar96@gmail.com - 2015-10-01 23:52 -0700
Re: New to the group Mark Wills <markwills1970@gmail.com> - 2015-10-02 01:52 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-02 08:36 -1000
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-02 17:00 -0400
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-10-02 14:46 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-02 18:10 -0400
Re: New to the group Paul Rubin <no.email@nospam.invalid> - 2015-10-02 16:08 -0700
Re: New to the group "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-02 20:44 -0400
Re: New to the group David Thompson <dave.thompson2@verizon.net> - 2015-10-31 06:54 -0400
Re: New to the group "Rod Pemberton" <too@zxcvfeqad.cdm> - 2015-11-02 02:34 -0500
Re: New to the group David Thompson <dave.thompson2@verizon.net> - 2015-12-22 06:45 -0500
Re: New to the group "Rod Pemberton" <too@zxcvfeqad.cdm> - 2015-11-02 02:34 -0500
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-02 15:16 -1000
Re: New to the group Paul Rubin <no.email@nospam.invalid> - 2015-10-02 18:21 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-02 15:38 -1000
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-02 22:13 -0400
Re: New to the group Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-10-03 22:24 +0100
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-03 17:33 -0400
Re: New to the group hughaguilar96@gmail.com - 2015-09-30 17:00 -0700
Re: New to the group "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-30 20:38 -0400
Re: New to the group Walter Banks <walter@bytecraft.com> - 2015-10-02 14:37 -0400
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-02 17:01 -0400
Re: New to the group hughaguilar96@gmail.com - 2015-10-02 23:35 -0700
Re: New to the group "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-30 18:11 -0400
Re: New to the group Coos Haak <chforth@hccnet.nl> - 2015-10-01 02:13 +0200
Re: New to the group Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-09-30 08:38 +0100
Re: New to the group Walter Banks <walter@bytecraft.com> - 2015-09-30 10:58 -0400
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-10-01 06:04 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-01 09:46 -0400
Re: New to the group anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-08 06:07 +0000
Re: New to the group Alfred Singlestone <vitonis@gmail.com> - 2015-10-09 04:04 -0700
Re: New to the group rickman <gnuarm@gmail.com> - 2015-10-09 10:29 -0400
Re: New to the group anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-09 15:30 +0000
Re: New to the group lehs <skydda.barnen@gmail.com> - 2015-10-03 00:19 -0700
Re: New to the group visualforth@rocketmail.com - 2015-10-03 17:01 -0700
Re: New to the group anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-08 06:38 +0000
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-07 21:15 -1000
Minimal wordset (was: New to the group) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-08 13:39 +0000
Re: Minimal wordset (was: New to the group) JUERGEN <epldfpga@aol.com> - 2015-10-08 08:13 -0700
Re: Minimal wordset (was: New to the group) Mark Wills <markwills1970@gmail.com> - 2015-10-09 00:55 -0700
Re: Minimal wordset Lars Brinkhoff <lars.spam@nocrew.org> - 2015-10-09 10:43 +0200
Re: Minimal wordset Chris Curl <ccurl609@gmail.com> - 2015-10-09 06:56 -0700
Re: Minimal wordset Lars Brinkhoff <lars.spam@nocrew.org> - 2015-10-09 19:44 +0200
Re: Minimal wordset Paul Rubin <no.email@nospam.invalid> - 2015-10-09 14:02 -0700
Re: Minimal wordset Jan Coombs <Jan-54 <jenfhaomndgfwutc@murmic.plus.com>> - 2015-10-10 09:44 +0100
Re: Minimal wordset anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-10 11:36 +0000
Re: Minimal wordset lehs <skydda.barnen@gmail.com> - 2015-10-09 08:40 -0700
Re: Minimal wordset Lars Brinkhoff <lars.spam@nocrew.org> - 2015-10-09 19:53 +0200
Re: Minimal wordset lehs <skydda.barnen@gmail.com> - 2015-10-09 11:22 -0700
Re: Minimal wordset JUERGEN <epldfpga@aol.com> - 2015-10-09 11:33 -0700
Re: Minimal wordset Lars Brinkhoff <lars.spam@nocrew.org> - 2015-10-09 20:38 +0200
Re: Minimal wordset stephen@mpeforth.com (Stephen Pelc) - 2015-10-09 20:56 +0000
Re: Minimal wordset rickman <gnuarm@gmail.com> - 2015-11-01 20:10 -0500
Re: Minimal wordset Coos Haak <chforth@hccnet.nl> - 2015-11-02 03:05 +0100
Re: Minimal wordset "Elizabeth D. Rather" <erather@forth.com> - 2015-11-01 16:08 -1000
Re: Minimal wordset stephen@mpeforth.com (Stephen Pelc) - 2015-11-02 09:35 +0000
Re: Minimal wordset anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-02 12:42 +0000
Re: Minimal wordset humptydumpty <ouatubi@gmail.com> - 2015-11-08 23:22 -0800
Re: Minimal wordset rickman <gnuarm@gmail.com> - 2015-11-03 11:25 -0500
Re: Minimal wordset stephen@mpeforth.com (Stephen Pelc) - 2015-11-03 19:36 +0000
Re: Minimal wordset "HAA" <someone@microsoft.com> - 2015-11-08 12:56 +1100
Re: Minimal wordset stephen@mpeforth.com (Stephen Pelc) - 2015-11-08 16:14 +0000
Re: Minimal wordset "HAA" <someone@microsoft.com> - 2015-11-09 11:55 +1100
Re: Minimal wordset anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-02 09:41 +0000
Re: Minimal wordset rickman <gnuarm@gmail.com> - 2015-11-03 11:29 -0500
Re: Minimal wordset anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-03 17:01 +0000
Re: Minimal wordset JUERGEN <epldfpga@aol.com> - 2015-10-09 11:27 -0700
Re: Minimal wordset (was: New to the group) "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-09 23:11 -0400
Re: Minimal wordset (was: New to the group) Jan Coombs <Jan-54 <jenfhaomndgfwutc@murmic.plus.com>> - 2015-10-10 08:38 +0100
Re: New to the group dunno <dunno@dunno.dunno> - 2015-10-14 23:14 +0000
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-14 16:21 -1000
Re: New to the group anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-15 08:46 +0000
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-10-03 09:23 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-03 09:19 -1000
Re: New to the group lehs <skydda.barnen@gmail.com> - 2015-10-08 05:24 -0700
Re: New to the group "Elizabeth D. Rather" <erather@forth.com> - 2015-10-08 08:22 -1000
Re: New to the group lehs <skydda.barnen@gmail.com> - 2015-10-09 08:37 -0700
Re: New to the group Chris Curl <ccurl609@gmail.com> - 2015-10-31 10:44 -0700
csiph-web