Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

You can't go home again, unless you set $HOME.


devel / comp.lang.forth / Re: do you have ref on optimisation

SubjectAuthor
* do you have ref on optimisationgobli...@gmail.com
+- Re: do you have ref on optimisationnone
+* Re: do you have ref on optimisationminforth
|`* Re: do you have ref on optimisationdxforth
| `* Re: do you have ref on optimisationminforth
|  `* Re: do you have ref on optimisationdxforth
|   `* Re: do you have ref on optimisationS Jack
|    `* Re: do you have ref on optimisationdxforth
|     `* Re: do you have ref on optimisationS Jack
|      `- Re: do you have ref on optimisationdxforth
+* Re: do you have ref on optimisationBrian Fox
|`- Re: do you have ref on optimisationdxforth
`- Re: do you have ref on optimisationStephen Pelc

1
do you have ref on optimisation

<9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24170&group=comp.lang.forth#24170

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:580b:0:b0:403:b221:ea4f with SMTP id g11-20020ac8580b000000b00403b221ea4fmr11706qtg.7.1691226669920;
Sat, 05 Aug 2023 02:11:09 -0700 (PDT)
X-Received: by 2002:a05:6808:30a0:b0:3a1:f2a4:3d7 with SMTP id
bl32-20020a05680830a000b003a1f2a403d7mr6328592oib.1.1691226669627; Sat, 05
Aug 2023 02:11:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Aug 2023 02:11:09 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:e23f:49ff:fed4:3289;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:e23f:49ff:fed4:3289
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
Subject: do you have ref on optimisation
From: goblinrieur@gmail.com (gobli...@gmail.com)
Injection-Date: Sat, 05 Aug 2023 09:11:09 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1471
 by: gobli...@gmail.com - Sat, 5 Aug 2023 09:11 UTC

hello,

did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?

I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.

I'm also interested if you have such references as books too :) even I have already many beginners books.

regards.

Re: do you have ref on optimisation

<nnd$2e598c8d$09f1d1d2@16e3ca9f8806becf>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24171&group=comp.lang.forth#24171

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$2e598c8d$09f1d1d2@16e3ca9f8806becf>
Organization: KPN B.V.
Date: Sat, 05 Aug 2023 11:46:03 +0200
Path: i2pn2.org!i2pn.org!news.neodome.net!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 30
Injection-Date: Sat, 05 Aug 2023 11:46:03 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1876
 by: none - Sat, 5 Aug 2023 09:46 UTC

In article <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>,
gobli...@gmail.com <goblinrieur@gmail.com> wrote:
>hello,
>
>did anyone have wrote a specific document about optimization & good
>practice or tips in forth ? or have good links about that to provide ?
>
>I'm still learning & have access to I think all "well known" sites but I
>wonder continue my learning :) & rewrite a better way my current
>trainning codes.
>
>I'm also interested if you have such references as books too :) even I
>have already many beginners books.

https://home.hccnet.nl/a.w.m.van.der.horst/forthlectures.html
This contains a write up how to do optimisers in Forth.
I actually have implemented this for ciforth.
Also Marcel Hendrix took inspiration from it. (His iforth and
MPE-forth are probably the fastest Forth's around.).

>
>regards.
>
Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: do you have ref on optimisation

<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24172&group=comp.lang.forth#24172

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:5609:b0:63d:a43:7b06 with SMTP id mg9-20020a056214560900b0063d0a437b06mr13261qvb.9.1691244472048;
Sat, 05 Aug 2023 07:07:52 -0700 (PDT)
X-Received: by 2002:a05:6830:458e:b0:6bc:6658:2d3f with SMTP id
az14-20020a056830458e00b006bc66582d3fmr2747631otb.1.1691244471798; Sat, 05
Aug 2023 07:07:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Aug 2023 07:07:51 -0700 (PDT)
In-Reply-To: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=87.157.100.57; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 87.157.100.57
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>
Subject: Re: do you have ref on optimisation
From: minforth@arcor.de (minforth)
Injection-Date: Sat, 05 Aug 2023 14:07:52 +0000
Content-Type: text/plain; charset="UTF-8"
 by: minforth - Sat, 5 Aug 2023 14:07 UTC

gobli...@gmail.com schrieb am Samstag, 5. August 2023 um 11:11:11 UTC+2:
> hello,
>
> did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?
>
> I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.
>
> I'm also interested if you have such references as books too :) even I have already many beginners books.

I guess you have gone through Leo Brodie's two classic books.

Thereafter it really depends on your optimisation goal. For instance
- execution speed
- least memory footprint
- least burnt milliwatts embedded
- most concise source code
- ease of maintenance in a team

For the first three: know your hardware!

This does not answer your question, but might explain why there are not
many generic reference papers around. Although not for Forth, but for assembler and C,
I found Agner Fog's papers on optimization very helpful:
https://www.agner.org/optimize/

Re: do you have ref on optimisation

<ebcab710-cfa6-47e4-8afd-0a205b221922n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24173&group=comp.lang.forth#24173

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5a95:0:b0:40f:e2a5:3100 with SMTP id c21-20020ac85a95000000b0040fe2a53100mr16250qtc.6.1691254498437;
Sat, 05 Aug 2023 09:54:58 -0700 (PDT)
X-Received: by 2002:a05:6830:1394:b0:6b9:a422:9f with SMTP id
d20-20020a056830139400b006b9a422009fmr5098115otq.1.1691254498107; Sat, 05 Aug
2023 09:54:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!3.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Aug 2023 09:54:57 -0700 (PDT)
In-Reply-To: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=184.75.211.142; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 184.75.211.142
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ebcab710-cfa6-47e4-8afd-0a205b221922n@googlegroups.com>
Subject: Re: do you have ref on optimisation
From: brian.fox@brianfox.ca (Brian Fox)
Injection-Date: Sat, 05 Aug 2023 16:54:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 84
 by: Brian Fox - Sat, 5 Aug 2023 16:54 UTC

On Saturday, August 5, 2023 at 5:11:11 AM UTC-4, gobli...@gmail.com wrote:
> hello,
>
> did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?
>
> I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.
>
> I'm also interested if you have such references as books too :) even I have already many beginners books.
>
> regards.

Not sure what you mean by optimizing. It could mean an optimizing compiler but it could also
mean how to write more efficient Forth code.

On the latter issue there is a strange aspect of Forth that is more akin to a CPU instruction set.
By that I mean there are hundreds of these little code snippets and they can be used in ways
that are not always obvious. As an example the word COUNT is generally thought of as a way
to unpack a counted string and return the text address and the length but I was amazed to see
it used as a way to index a string, character by character, like this:

: TYPE ( addr len -- ) 0 DO COUNT EMIT LOOP DROP ;

COUNT could probably also be used as part of a character parser.
I have only recently started trying to see Forth this way so that is why I am commenting.

*DISCLAIMER : There are real experts on this subject In this forum.
These comments are hobby coder trying to learn something on the matter.

My hobby work involves a machine with glacial performance so making faster Forth is rewarding.
Also with a really slow machine you get first hand experience on what really makes a difference.

One approach I took to optimizing indirect threaded code was to copy primitive code words
in memory end to end and use them as "headless" definitions. I believe GForth calls these
super-instructions and does them as a matter of course. (? Anton ?)

This gave some benefits but I found other bottle-necks.
If you are going to compile native code then there are more efficient ways to handle
variables and constants so that led to detecting those words and compiling appropriate code.

But then a bottle-neck shows up around branching and looping because the threaded interpreter
is limiting the flat out speed of IF, ELSE, WHILE, AGAIN and UNTIL so that led to detecting
those words and compiling native code jumps.

If it is of interest you can see the evolution in these two files.
They may provide some ideas from someone else who is feeling their way along. :-)

https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/INLINE.FTH

https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/JIT.FTH

To give you a sense of the improvement achievable, 10 iterations of the Byte Magazine Sieve
takes 120 seconds running on this 1978 era CPU using ITC Camel Forth.
(LOL I'm not kidding)

Using the JIT on the computational section reduces the time to 49 seconds.

However a fully native code version in a Machine Forth I wrote, using native registers as locals
runs in just under 10 seconds.

All that to say compilers like VFX and iForth are doing much more than the obvious stuff.

Re: do you have ref on optimisation

<uam0dd$1q746$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24174&group=comp.lang.forth#24174

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
Date: Sun, 6 Aug 2023 03:20:44 +1000
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <uam0dd$1q746$1@dont-email.me>
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 5 Aug 2023 17:20:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="18ff55d3e947571ac4bd3074d6fc6139";
logging-data="1907846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DhHC07+8zP5yDymrslvnH"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:N6CCr8JltlC5Zc8Jo8XiA/ST+z0=
Content-Language: en-GB
In-Reply-To: <437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>
 by: dxforth - Sat, 5 Aug 2023 17:20 UTC

On 6/08/2023 12:07 am, minforth wrote:
> gobli...@gmail.com schrieb am Samstag, 5. August 2023 um 11:11:11 UTC+2:
>> hello,
>>
>> did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?
>>
>> I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.
>>
>> I'm also interested if you have such references as books too :) even I have already many beginners books.
>
> I guess you have gone through Leo Brodie's two classic books.
>
> Thereafter it really depends on your optimisation goal. For instance
> - execution speed
> - least memory footprint
> - least burnt milliwatts embedded
> - most concise source code
> - ease of maintenance in a team
>
> For the first three: know your hardware!
>
> This does not answer your question, but might explain why there are not
> many generic reference papers around. Although not for Forth, but for assembler and C,
> I found Agner Fog's papers on optimization very helpful:
> https://www.agner.org/optimize/

Following that link I found myself at the MASM website browsing the following page:

https://www.masm32.com/why.htm

Reading the third paragraph and substituting each occurrence of "MASM" with "FORTH",
it struck me as something Moore might say. His 'no compromise' stance is legend.
MASM users knowing what they're about simply say 'not for the faint hearted'. No
mention of ease of maintenance in a team as a goal at all. Perhaps it's Forth that
has lost its way.

Re: do you have ref on optimisation

<93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24175&group=comp.lang.forth#24175

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4396:b0:76c:ded2:90d0 with SMTP id a22-20020a05620a439600b0076cded290d0mr13967qkp.7.1691262144771;
Sat, 05 Aug 2023 12:02:24 -0700 (PDT)
X-Received: by 2002:a9d:74cb:0:b0:6b7:3eba:59d3 with SMTP id
a11-20020a9d74cb000000b006b73eba59d3mr5404687otl.6.1691262144365; Sat, 05 Aug
2023 12:02:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Aug 2023 12:02:23 -0700 (PDT)
In-Reply-To: <uam0dd$1q746$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f21:96cb:de4:45ea:11a8:a0a6;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f21:96cb:de4:45ea:11a8:a0a6
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com> <uam0dd$1q746$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com>
Subject: Re: do you have ref on optimisation
From: minforth@arcor.de (minforth)
Injection-Date: Sat, 05 Aug 2023 19:02:24 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3497
 by: minforth - Sat, 5 Aug 2023 19:02 UTC

dxforth schrieb am Samstag, 5. August 2023 um 19:20:48 UTC+2:
> On 6/08/2023 12:07 am, minforth wrote:
> > gobli...@gmail.com schrieb am Samstag, 5. August 2023 um 11:11:11 UTC+2:
> >> hello,
> >>
> >> did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?
> >>
> >> I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.
> >>
> >> I'm also interested if you have such references as books too :) even I have already many beginners books.
> >
> > I guess you have gone through Leo Brodie's two classic books.
> >
> > Thereafter it really depends on your optimisation goal. For instance
> > - execution speed
> > - least memory footprint
> > - least burnt milliwatts embedded
> > - most concise source code
> > - ease of maintenance in a team
> >
> > For the first three: know your hardware!
> >
> > This does not answer your question, but might explain why there are not
> > many generic reference papers around. Although not for Forth, but for assembler and C,
> > I found Agner Fog's papers on optimization very helpful:
> > https://www.agner.org/optimize/
> Following that link I found myself at the MASM website browsing the following page:
>
> https://www.masm32.com/why.htm
>
> Reading the third paragraph and substituting each occurrence of "MASM" with "FORTH",
> it struck me as something Moore might say. His 'no compromise' stance is legend.
> MASM users knowing what they're about simply say 'not for the faint hearted'. No
> mention of ease of maintenance in a team as a goal at all. Perhaps it's Forth that
> has lost its way.

You are right in that "ease of maintenance" is of little importance in one-man software
shows, eg like Forth hobbyist projects, or for assembly trick programming nerds.

For industrial applications "ease of maintenance" has a quite different impact. Imagine
MCUs running for years somewhere on the globe. The paying customer wants some
software troubleshooting or update with minimal downtime. Now put yourself in the shoes
of the service engineer who has to go there...

Re: do you have ref on optimisation

<uan8aq$23ff7$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24176&group=comp.lang.forth#24176

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
Date: Sun, 6 Aug 2023 14:42:02 +1000
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <uan8aq$23ff7$1@dont-email.me>
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>
<uam0dd$1q746$1@dont-email.me>
<93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 6 Aug 2023 04:42:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="72dcc580a9d1f82334dca1921a816e5a";
logging-data="2211303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZDF1Oc2psfQlcycxr4rAs"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:t2Waz24C24EcYnDxHDdIfG/frlw=
In-Reply-To: <93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Sun, 6 Aug 2023 04:42 UTC

On 6/08/2023 5:02 am, minforth wrote:
> dxforth schrieb am Samstag, 5. August 2023 um 19:20:48 UTC+2:
>> On 6/08/2023 12:07 am, minforth wrote:
>>> gobli...@gmail.com schrieb am Samstag, 5. August 2023 um 11:11:11 UTC+2:
>>>> hello,
>>>>
>>>> did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?
>>>>
>>>> I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.
>>>>
>>>> I'm also interested if you have such references as books too :) even I have already many beginners books.
>>>
>>> I guess you have gone through Leo Brodie's two classic books.
>>>
>>> Thereafter it really depends on your optimisation goal. For instance
>>> - execution speed
>>> - least memory footprint
>>> - least burnt milliwatts embedded
>>> - most concise source code
>>> - ease of maintenance in a team
>>>
>>> For the first three: know your hardware!
>>>
>>> This does not answer your question, but might explain why there are not
>>> many generic reference papers around. Although not for Forth, but for assembler and C,
>>> I found Agner Fog's papers on optimization very helpful:
>>> https://www.agner.org/optimize/
>> Following that link I found myself at the MASM website browsing the following page:
>>
>> https://www.masm32.com/why.htm
>>
>> Reading the third paragraph and substituting each occurrence of "MASM" with "FORTH",
>> it struck me as something Moore might say. His 'no compromise' stance is legend.
>> MASM users knowing what they're about simply say 'not for the faint hearted'. No
>> mention of ease of maintenance in a team as a goal at all. Perhaps it's Forth that
>> has lost its way.
>
> You are right in that "ease of maintenance" is of little importance in one-man software
> shows, eg like Forth hobbyist projects, or for assembly trick programming nerds.
>
> For industrial applications "ease of maintenance" has a quite different impact. Imagine
> MCUs running for years somewhere on the globe. The paying customer wants some
> software troubleshooting or update with minimal downtime. Now put yourself in the shoes
> of the service engineer who has to go there...

I've been there as an electronics service engineer. There was no question of HP or
Tektronix dumbing down their products for fear it might upset some future service
manager. Either the service organization has personnel of sufficient competence to
handle it - or they don't. Same applies to designers.

Re: do you have ref on optimisation

<uangnd$24odf$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24177&group=comp.lang.forth#24177

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
Date: Sun, 6 Aug 2023 17:05:17 +1000
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uangnd$24odf$1@dont-email.me>
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<ebcab710-cfa6-47e4-8afd-0a205b221922n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 6 Aug 2023 07:05:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="72dcc580a9d1f82334dca1921a816e5a";
logging-data="2253231"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ofseUO+05KO/7cgw4jkbA"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:acfP/eADycQaiNYjze/BaUT/h0s=
In-Reply-To: <ebcab710-cfa6-47e4-8afd-0a205b221922n@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Sun, 6 Aug 2023 07:05 UTC

On 6/08/2023 2:54 am, Brian Fox wrote:
> On Saturday, August 5, 2023 at 5:11:11 AM UTC-4, gobli...@gmail.com wrote:
>> hello,
>>
>> did anyone have wrote a specific document about optimization & good practice or tips in forth ? or have good links about that to provide ?
>>
>> I'm still learning & have access to I think all "well known" sites but I wonder continue my learning :) & rewrite a better way my current trainning codes.
>>
>> I'm also interested if you have such references as books too :) even I have already many beginners books.
>>
>> regards.
>
> Not sure what you mean by optimizing. It could mean an optimizing compiler but it could also
> mean how to write more efficient Forth code.
>
> On the latter issue there is a strange aspect of Forth that is more akin to a CPU instruction set.
> By that I mean there are hundreds of these little code snippets and they can be used in ways
> that are not always obvious.

Further to the first point, it would be a mistake to judge 'good Forth' by the standards
of other languages. The latter factor in environmental factors such as optimizing compilers.
Moore's position has been write optimum code and the need for fancy compilers goes away.
There's a reason GCC is such a monster. I wish its team of maintainers the best of luck.

Re: do you have ref on optimisation

<690bee41-c150-454d-ba66-33d65fc72a0bn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24178&group=comp.lang.forth#24178

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1991:b0:40e:6f1:3d45 with SMTP id u17-20020a05622a199100b0040e06f13d45mr24808qtc.2.1691339208689;
Sun, 06 Aug 2023 09:26:48 -0700 (PDT)
X-Received: by 2002:a05:6808:1288:b0:3a7:4355:339c with SMTP id
a8-20020a056808128800b003a74355339cmr11819992oiw.5.1691339208382; Sun, 06 Aug
2023 09:26:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 6 Aug 2023 09:26:48 -0700 (PDT)
In-Reply-To: <uan8aq$23ff7$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:2509:2578:5334:1a9a;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:2509:2578:5334:1a9a
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com> <uam0dd$1q746$1@dont-email.me>
<93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com> <uan8aq$23ff7$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <690bee41-c150-454d-ba66-33d65fc72a0bn@googlegroups.com>
Subject: Re: do you have ref on optimisation
From: sdwjack69@gmail.com (S Jack)
Injection-Date: Sun, 06 Aug 2023 16:26:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: S Jack - Sun, 6 Aug 2023 16:26 UTC

On Saturday, August 5, 2023 at 11:42:07 PM UTC-5, dxforth wrote:
> On 6/08/2023 5:02 am, minforth wrote:

Never was an optimizing Nazi but always pursued
tricks of the trade e.g. xor register to itself
instead of moving zero into it. But after Hans
remark about bad style using flag as a mask and
previous comments of Albert about 'premature
optimization' it finally sunk in. Old habits
are too ingrained to completely give but now
strive to write straight code rather than some
peep-hole optimization. Just assume if someone
wants it optimized, they can run it through some
one's optimizing compiler. Or if in a speed bind
somewhere then sure attack it.
Currently in my latest retro Forth I'm spending
time importing code level word form previous
works and converting to them high level words in
the new Forth. In the past I would have had a
hard time making myself do such a thing but now
have no concern at all. Even found a new factor
I haven't seen before (probably with good reason)
"U->D", unsigned single to signed double.
--
me

Re: do you have ref on optimisation

<uaoj7a$2cueb$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24179&group=comp.lang.forth#24179

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: stephen@vfxforth.com (Stephen Pelc)
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
Date: Sun, 6 Aug 2023 16:54:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <uaoj7a$2cueb$1@dont-email.me>
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 6 Aug 2023 16:54:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="71f2230be0cbc46c73625bf9542b921f";
logging-data="2521547"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EpNgJIcYc069LtCIxCMG9"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:sGVs1kSZ/OqAcD/QN1DSCuAXrgY=
X-Usenapp: v1.27.1/l - Full License
 by: Stephen Pelc - Sun, 6 Aug 2023 16:54 UTC

On 5 Aug 2023 at 11:11:09 CEST, "goblinrieur@gmail.com"
<goblinrieur@gmail.com> wrote:

> did anyone have wrote a specific document about optimization & good practice
> or tips in forth ? or have good links about that to provide ?

Optimisation of Forth is really no different than for other languages. If
there is a difference, it is
that the Forth basic block (what's inside a control structure) is usually
very/rather small.

Start with all the classic texts from the dragon books onwards. See also
Fraser and Hansen - Retargetable C compiler: Design and implementation
get the second edition

Fischer & LeBlanc (et al) - Crafting a Compiler
We liked it. There appears to be PDF floating around.

Note that paper books about compiler are expensive.

You will also fing that the parsing requirements for Forth are almost trivial,
and that the key
is in designing the data structures to represent the Forth data and the
instruction selection.
For example, DUP need generate no code until one part is copied modified or
moved. For
example
DUP 8 + @
can be reduced to one instruction in many instruction sets. This example
requires you
to perform some degree of back-tracking in some designs.

You have to decide what your objectives are.

Stephen

>
> I'm still learning & have access to I think all "well known" sites but I
> wonder continue my learning :) & rewrite a better way my current trainning
> codes.
>
> I'm also interested if you have such references as books too :) even I have
> already many beginners books.
>
> regards.
>

--
Stephen Pelc, stephen@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)78 0390 3612, +34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Re: do you have ref on optimisation

<uaqgm6$2ot8p$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24181&group=comp.lang.forth#24181

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
Date: Mon, 7 Aug 2023 20:23:03 +1000
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <uaqgm6$2ot8p$1@dont-email.me>
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>
<uam0dd$1q746$1@dont-email.me>
<93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com>
<uan8aq$23ff7$1@dont-email.me>
<690bee41-c150-454d-ba66-33d65fc72a0bn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 7 Aug 2023 10:23:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f3c0bf529c0eddcae72dfbac9129db98";
logging-data="2913561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HUmh/a5NlJHtFtEqJH4/r"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:xSBQgE5NDym7p1SZ6klcUGg6ZHY=
In-Reply-To: <690bee41-c150-454d-ba66-33d65fc72a0bn@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Mon, 7 Aug 2023 10:23 UTC

On 7/08/2023 2:26 am, S Jack wrote:
> On Saturday, August 5, 2023 at 11:42:07 PM UTC-5, dxforth wrote:
>> On 6/08/2023 5:02 am, minforth wrote:
>
> Never was an optimizing Nazi but always pursued
> tricks of the trade e.g. xor register to itself
> instead of moving zero into it. But after Hans
> remark about bad style using flag as a mask and
> previous comments of Albert about 'premature
> optimization' it finally sunk in. Old habits
> are too ingrained to completely give but now
> strive to write straight code rather than some
> peep-hole optimization. Just assume if someone
> wants it optimized, they can run it through some
> one's optimizing compiler. Or if in a speed bind
> somewhere then sure attack it.

In any code one writes there will be opportunities to optimize.
I don't feel inclined to leave to an optimizer what I can do
myself. The latter are certainly not entitled to call Forth
code "tricky" if that's what they do under the hood out of sight.

Re: do you have ref on optimisation

<63027f6c-0edd-4b9b-b795-a46f18d95efan@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24182&group=comp.lang.forth#24182

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:b646:0:b0:767:3d3d:7cc4 with SMTP id g67-20020a37b646000000b007673d3d7cc4mr27764qkf.1.1691422993885;
Mon, 07 Aug 2023 08:43:13 -0700 (PDT)
X-Received: by 2002:a05:6808:1584:b0:3a7:26fe:ed3 with SMTP id
t4-20020a056808158400b003a726fe0ed3mr16740620oiw.4.1691422993586; Mon, 07 Aug
2023 08:43:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 7 Aug 2023 08:43:13 -0700 (PDT)
In-Reply-To: <uaqgm6$2ot8p$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:2c5c:22cf:91d:f635;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:2c5c:22cf:91d:f635
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com> <uam0dd$1q746$1@dont-email.me>
<93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com> <uan8aq$23ff7$1@dont-email.me>
<690bee41-c150-454d-ba66-33d65fc72a0bn@googlegroups.com> <uaqgm6$2ot8p$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <63027f6c-0edd-4b9b-b795-a46f18d95efan@googlegroups.com>
Subject: Re: do you have ref on optimisation
From: sdwjack69@gmail.com (S Jack)
Injection-Date: Mon, 07 Aug 2023 15:43:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2714
 by: S Jack - Mon, 7 Aug 2023 15:43 UTC

On Monday, August 7, 2023 at 5:23:06 AM UTC-5, dxforth wrote:

> In any code one writes there will be opportunities to optimize.

Optimized for which processor? A general optimization
perhaps, but wouldn't that be "premature".

Some months back someone published a nice math library.
All the code was straight Forth code, most words
short and sweet. There were no "AND TRUE"s to avoid
IF statements or other such common Forth idiosyncrasy.
I thought it good clear logic; no need to muddle with
optimization until optimization is needed.
In Frog I reluctantly changed TRUE from 1 to -1 for
that advantage of avoiding IF statements. I was
reluctant because the assemblers that I knew had
instructions that expected 1 for TRUE and I wanted
to keep my Forth close to assembly. I always regretted
it, not for any practical reason but for preference,
and planned on changing it back. Then came Toad, pure
retro, and I'm happy to have TRUE is 1 back along with
the other warts.
In industry software is always having to make up for
short comings of the hardware. Well, now being free
I no longer feel the need to follow the hardware.
I pretend perfect hardware exists that can handle
IF statements without penalty.
--
me

Re: do you have ref on optimisation

<uasnc2$37j2t$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24185&group=comp.lang.forth#24185

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: do you have ref on optimisation
Date: Tue, 8 Aug 2023 16:29:22 +1000
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <uasnc2$37j2t$1@dont-email.me>
References: <9652494d-e625-4e86-a6b0-3fd25851e09en@googlegroups.com>
<437e23b7-1c00-4411-8b56-28408ec2344en@googlegroups.com>
<uam0dd$1q746$1@dont-email.me>
<93c2c097-05c6-427a-93f6-b45a13cb2453n@googlegroups.com>
<uan8aq$23ff7$1@dont-email.me>
<690bee41-c150-454d-ba66-33d65fc72a0bn@googlegroups.com>
<uaqgm6$2ot8p$1@dont-email.me>
<63027f6c-0edd-4b9b-b795-a46f18d95efan@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 8 Aug 2023 06:29:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ffb73633e28fe7e90650d76b2ea90b96";
logging-data="3394653"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ntrxz8A3UD7CbPfKWrJs4"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:kSdpKnt7MbkH1gBKff118dUubkk=
Content-Language: en-GB
In-Reply-To: <63027f6c-0edd-4b9b-b795-a46f18d95efan@googlegroups.com>
 by: dxforth - Tue, 8 Aug 2023 06:29 UTC

On 8/08/2023 1:43 am, S Jack wrote:
> On Monday, August 7, 2023 at 5:23:06 AM UTC-5, dxforth wrote:
>
>> In any code one writes there will be opportunities to optimize.
>
> Optimized for which processor? A general optimization
> perhaps, but wouldn't that be "premature".

I'm talking about forth. Forth is low level compared to most HLL with
the result concise forth translates to efficient code irrespective of
processor. If one includes HLL elements such as locals the correlation
between source and code generated is muddied. All the programmer can
do in the latter case is apply post-optimization and hope for the best.
But since forth is still low level it limits what such optimizers can
achieve without re-organizing the code. Folks may wish to test their
optimizers here:

https://pastebin.com/HpDnzsGj

> Some months back someone published a nice math library.
> All the code was straight Forth code, most words
> short and sweet. There were no "AND TRUE"s to avoid
> IF statements or other such common Forth idiosyncrasy.
> I thought it good clear logic; no need to muddle with
> optimization until optimization is needed.

Sometimes there's nothing to optimize. I think it's a mistake to apply
norms of other languages to Forth and called it idiosyncratic. I did
that when I first came to Forth. In my case the carry-over was BASIC.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor