Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #45206
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Forth dictionary implementation and performance |
| Date | 2016-01-30 17:51 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2016Jan30.185130@mips.complang.tuwien.ac.at> (permalink) |
| References | <2016Jan29.184253@mips.complang.tuwien.ac.at> <n8h1l5$l39$1@dont-email.me> <2016Jan30.181821@mips.complang.tuwien.ac.at> |
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>It takes 180M cycles with gforth-fast on the reference machine, 36M of
>which are consumed when just starting gforth-fast (so essentially 144M
>for the actual program). Here are the detailed results:
>
> 179883538 cycles # 0.000 M/sec
> 157894542 instructions # 0.878 IPC
> 3568630 branch-misses # 0.000 M/sec
> 1269773 L1-dcache-load-misses # 0.000 M/sec
> 53807814 L1-dcache-loads # 0.000 M/sec
>
>How much of that is due to FIND-NAME? If I first define FIND-NAME as
>
>: find-name 2drop 0 ;
>
>I get
>
>
> 149942202 cycles # 0.000 M/sec
> 139562133 instructions # 0.931 IPC
> 2626759 branch-misses # 0.000 M/sec
> 839842 L1-dcache-load-misses # 0.000 M/sec
> 47026545 L1-dcache-loads # 0.000 M/sec
>
>If I replace it with
>
>: find-name 2drop [ s" #wordlists" find-name ]l ;
>
>I get
>
> 154854243 cycles # 0.000 M/sec
> 143084355 instructions # 0.924 IPC
> 2775349 branch-misses # 0.000 M/sec
> 884432 L1-dcache-load-misses # 0.000 M/sec
> 48098345 L1-dcache-loads # 0.000 M/sec
>
>I.e., 25-30M cycles spent in FIND-NAME. So there is quite a bit of
>potential for improvement there, but given that the other overheads
>are so large, it's probably better to spend the effort elsewhere
>first.
Ok, looking at it again, dynamic native code generation is disabled in
the engine built on that machine (I now remember that gcc-4.4 was one
of the particularly bad versions). Running on the Haswell with
gcc-4.9.2, I see
56837722 cycles:u
135146121 instructions:u # 2.38 insns per cycle
266092 branch-misses:u
553092 L1-dcache-load-misses # 1.57% of all L1-dcache hits
35236800 L1-dcache-loads
With : find-name 2drop 0 ;
50547534 cycles:u
122063613 instructions:u # 2.41 insns per cycle
239118 branch-misses:u
459065 L1-dcache-load-misses # 1.44% of all L1-dcache hits
31907684 L1-dcache-loads
With : find-name 2drop [ s" #wordlists" find-name ]l ;
51313405 cycles:u
122069990 instructions:u # 2.38 insns per cycle
241427 branch-misses:u
476163 L1-dcache-load-misses # 1.49% of all L1-dcache hits
31896977 L1-dcache-loads
So the FIND-NAME overhead is 5-6M instructions. Still quite a bit
more than the best the students got (and their result include all the
other things as well), but significantly better than it appeared at
first. But again, other overheads dominate here, and probably even
more so for real text interpretation.
- 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
Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-29 17:42 +0000
Re: Forth dictionary implementation and performance Paul Rubin <no.email@nospam.invalid> - 2016-01-29 16:20 -0800
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-30 13:54 +0000
Re: Forth dictionary implementation and performance Paul Rubin <no.email@nospam.invalid> - 2016-01-31 11:57 -0800
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-01 06:47 +0000
Re: Forth dictionary implementation and performance Paul Rubin <no.email@nospam.invalid> - 2016-02-01 00:47 -0800
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-01 11:13 +0000
Re: Forth dictionary implementation and performance Bernd Paysan <bernd.paysan@gmx.de> - 2016-01-30 01:57 +0100
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-30 17:18 +0000
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-30 17:51 +0000
Re: Forth dictionary implementation and performance Paul Rubin <no.email@nospam.invalid> - 2016-01-29 18:01 -0800
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-30 13:59 +0000
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-30 17:38 +0000
Re: Forth dictionary implementation and performance Paul Rubin <no.email@nospam.invalid> - 2016-01-31 12:05 -0800
Re: Forth dictionary implementation and performance Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-02-01 03:01 +0000
Re: Forth dictionary implementation and performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-01 06:17 +0000
Re: Forth dictionary implementation and performance "Elizabeth D. Rather" <erather@forth.com> - 2016-01-31 21:27 -1000
Re: Forth dictionary implementation and performance hughaguilar96@gmail.com - 2016-01-30 15:42 -0800
csiph-web