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


Groups > comp.lang.forth > #32142

Re: Reduce dictionary lookups using LIT ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail
From "Rod Pemberton" <dont_use_email@xnothavet.cqm>
Newsgroups comp.lang.forth
Subject Re: Reduce dictionary lookups using LIT ?
Date Thu, 03 Jul 2014 03:01:29 -0400
Organization Aioe.org NNTP Server
Lines 47
Message-ID <op.xietsrwb6zenlw@localhost> (permalink)
References <op.xicgra2o6zenlw@localhost> <e5dd3ad4-b6b9-4ece-afca-bf27739c53c8@googlegroups.com> <lp17eg$96b$1@online.de>
NNTP-Posting-Host CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed; delsp=yes
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Opera Mail/12.16 (Linux)
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.forth:32142

Show key headers only | View raw


On Wed, 02 Jul 2014 11:11:11 -0400, Bernd Paysan <bernd.paysan@gmx.de>  
wrote:
> Mark Wills wrote:

>> But... Is your system so slow that you need this? Rhetorical.
>
> It's a Rod Pemberton idea.  Assume it to be wrong in every way.

It came from a partial quote from a book in Google Books which
came up when I searched for LITERAL or LIT or something.  Of course,
it was probably from the 1980's and not that common a thing.
Another quote seems to indicate it was a Forth-83 thing.

> In this case, the lookup for names comes before the lookup for
> numbers, so if you find a name, you are done, the time for number
> conversion isn't necessary.  However, if he has a linear search,
> and LIT (or maybe D# and H#, a they are used in some Forths to
> denote specific bases rather than having the base prefixes) is
> found pretty early, then there is a benefit.  However, as such
> word would be defined pretty early (needed all the time), it is
> unlikely that you gain something.

The gain is likely neglible.  As "bruce.mcfarling" noted, the entire
dictionary is no longer searched it's entirety, but the dictionary
is still partially searched to find LIT.

> If you have lots of literals, a slow dictionary search, and your
> Forth words don't conflict with literals (they usually shouldn't,
> at least in decimal mode), you could turn the search around: First
> try to convert as literal, and if that fails, search.  This would
> give a benefit, as indentifying a number is pretty fast, and in
> the "many literals" case the search is completed when it's a literal.

In an optimized compiled Forth, I'd expect that attempting the number
conversion first to add a slight overhead per word that would be far
less than a partial dictionary search for LIT.

In a threaded-interpreted Forth, I'd expect the ITC or DTC number
conversion routine to take much longer, perhaps comparable to a
full dictionary search.  There is much looping and division.

> With Gforth's development version, you can shuffle the recognizer
> stack to give it a try.  But Gforth has a fast dictionary lookup ...

...

Rod Pemberton

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-01 20:24 -0400
  Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-01 19:39 -1000
    Re: Reduce dictionary lookups using LIT ? bruce.mcfarling@gmail.com - 2014-07-02 10:30 -0700
      Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-02 08:53 -1000
      Re: Reduce dictionary lookups using LIT ? Mark Wills <markwills1970@gmail.com> - 2014-07-02 13:47 -0700
        Re: Reduce dictionary lookups using LIT ? BruceMcF <agila61@netscape.net> - 2014-07-02 19:45 -0700
          Re: Reduce dictionary lookups using LIT ? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-07-03 16:56 +0000
            Re: Reduce dictionary lookups using LIT ? bruce.mcfarling@gmail.com - 2014-07-03 10:34 -0700
  Re: Reduce dictionary lookups using LIT ? Mark Wills <markwills1970@gmail.com> - 2014-07-02 01:27 -0700
    Re: Reduce dictionary lookups using LIT ? Bernd Paysan <bernd.paysan@gmx.de> - 2014-07-02 17:11 +0200
      Re: Reduce dictionary lookups using LIT ? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-07-02 16:31 +0000
        Re: Reduce dictionary lookups using LIT ? Bernd Paysan <bernd.paysan@gmx.de> - 2014-07-02 20:32 +0200
      Re: Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-03 03:01 -0400
        Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-02 21:42 -1000
        Re: Reduce dictionary lookups using LIT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-03 16:05 +0000
    Re: Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-03 03:00 -0400
  Re: Reduce dictionary lookups using LIT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-02 09:35 +0000
    Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-02 06:51 -1000
  Re: Reduce dictionary lookups using LIT ? chitselb <chitselb@gmail.com> - 2014-07-02 14:30 -0700
    Re: Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-03 03:51 -0400
  Re: Reduce dictionary lookups using LIT ? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-07-03 02:41 -0700
    Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 11:44 +0100
      Re: Reduce dictionary lookups using LIT ? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-07-03 06:03 -0700
        Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 15:16 +0100
          Re: Reduce dictionary lookups using LIT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-03 16:31 +0000
            Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 19:58 +0100
              Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 20:02 +0100

csiph-web