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


Groups > comp.lang.forth > #45204

Re: Forth dictionary implementation and performance

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:18 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2016Jan30.181821@mips.complang.tuwien.ac.at> (permalink)
References <2016Jan29.184253@mips.complang.tuwien.ac.at> <n8h1l5$l39$1@dont-email.me>

Show all headers | View raw


Bernd Paysan <bernd.paysan@gmx.de> writes:
>Anton Ertl wrote:
>
>> The best effort by the students took 2.3M cycles.  Unfortunately they
>> did not put their work online, but if you are interested in the
>> efforts of those few who did, you can look at
>> <https://www.complang.tuwien.ac.at/anton/lvas/effizienz-abgaben/2015w/>.
>
>How fast is Gforth on that benchmark by simply doing a FIND on all words 
>encountered, and then only checksums the results?

I have now written a Forth version of ep15.c that processes the same
input format (and produces the same result on a 64-bit machine):
<https://www.complang.tuwien.ac.at/anton/lvas/effizienz-aufgabe15/ep15.fs>

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.

- 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


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