Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"One lawyer can steal more than a hundred men with guns." -- The Godfather


devel / comp.lang.forth / porth

SubjectAuthor
* porthNN
+* Re: porthNickolay Kolchin
|+* Re: porthJan Coombs
||`* Re: porthNickolay Kolchin
|| `* Re: porthPaul Rubin
||  +* Re: porthdxforth
||  |`* Re: porthPaul Rubin
||  | `* Re: porthdxforth
||  |  +- Re: porthPaul Rubin
||  |  `* Re: porthantispam
||  |   `- Re: porthMarcel Hendrix
||  `* Re: porthNickolay Kolchin
||   +* Re: porthdxforth
||   |`* Re: porthMarcel Hendrix
||   | `* Re: porthdxforth
||   |  `* Re: porthMarcel Hendrix
||   |   `* Re: porthPaul Rubin
||   |    `* Re: porthdxforth
||   |     `- Re: porthNickolay Kolchin
||   +- Re: porthMarcel Hendrix
||   +* Re: porthAnton Ertl
||   |`- Re: porthNickolay Kolchin
||   `* Re: porthPaul Rubin
||    `- Re: porthNickolay Kolchin
|`* Re: porthRick C
| `- Re: porthNickolay Kolchin
`- Re: porthRobert L.

Pages:12
porth

<87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15268&group=comp.lang.forth#15268

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1aa5:: with SMTP id s37mr15322843qtc.377.1637146276318;
Wed, 17 Nov 2021 02:51:16 -0800 (PST)
X-Received: by 2002:ae9:f50a:: with SMTP id o10mr12634137qkg.510.1637146276046;
Wed, 17 Nov 2021 02:51:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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: Wed, 17 Nov 2021 02:51:15 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=86.187.228.220; posting-account=9A5f7goAAAD_QfJPZnlK3Xq_UhzYjdP-
NNTP-Posting-Host: 86.187.228.220
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
Subject: porth
From: november...@gmail.com (NN)
Injection-Date: Wed, 17 Nov 2021 10:51:16 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 5
 by: NN - Wed, 17 Nov 2021 10:51 UTC

I came across this - its supposed to be a forth in python.
The only thing forthy about it is it uses stacks and postfix.

That said,I found it interesting and worth watching.

https://www.youtube.com/playlist?list=PLpM-Dvs8t0VbMZA7wW9aR3EtBqe2kinu4

Re: porth

<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15270&group=comp.lang.forth#15270

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4687:: with SMTP id bq7mr12877850qkb.231.1637148335361;
Wed, 17 Nov 2021 03:25:35 -0800 (PST)
X-Received: by 2002:a05:6214:2505:: with SMTP id gf5mr53723720qvb.55.1637148335170;
Wed, 17 Nov 2021 03:25:35 -0800 (PST)
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: Wed, 17 Nov 2021 03:25:35 -0800 (PST)
In-Reply-To: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Wed, 17 Nov 2021 11:25:35 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Nickolay Kolchin - Wed, 17 Nov 2021 11:25 UTC

On Wednesday, November 17, 2021 at 1:51:17 PM UTC+3, NN wrote:
> I came across this - its supposed to be a forth in python.
> The only thing forthy about it is it uses stacks and postfix.
>
> That said,I found it interesting and worth watching.
>
> https://www.youtube.com/playlist?list=PLpM-Dvs8t0VbMZA7wW9aR3EtBqe2kinu4

IMHO, this is the second most stupid idea -- implementing forth in python.

Re: porth

<20211117122258.781af131@t530>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15271&group=comp.lang.forth#15271

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jan4comp...@murray-microft.co.uk (Jan Coombs)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Wed, 17 Nov 2021 12:22:58 +0000
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <20211117122258.781af131@t530>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="e27013e301222fa179b6e323dbd3e974";
logging-data="22538"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Li8Ryeri3FaFGcRldEPxscQ7WfSlBMAM="
Cancel-Lock: sha1:FRribuPLwcN4hXZsXHUz/wLrASs=
X-Newsreader: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
 by: Jan Coombs - Wed, 17 Nov 2021 12:22 UTC

On Wed, 17 Nov 2021 03:25:35 -0800 (PST)
Nickolay Kolchin <nbkolchin@gmail.com> wrote:

> On Wednesday, November 17, 2021 at 1:51:17 PM UTC+3, NN wrote:
> > I came across this - its supposed to be a forth in python.
> > The only thing forthy about it is it uses stacks and postfix.
> >
> > That said,I found it interesting and worth watching.
> >
> > https://www.youtube.com/playlist?list=PLpM-Dvs8t0VbMZA7wW9aR3EtBqe2kinu4
>
> IMHO, this is the second most stupid idea -- implementing forth in python.

For speed it exports assembler text, assembles, and links to build
an executable.

For porth interaction/simulation pypy is 'strongly recommended'
because this much faster than cython.

More detail in the README.md:
https://gitlab.com/tsoding/porth/-/blob/master/README.md

Jan Coombs
--

Re: porth

<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15272&group=comp.lang.forth#15272

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:f2d:: with SMTP id iw13mr55601109qvb.13.1637153469911;
Wed, 17 Nov 2021 04:51:09 -0800 (PST)
X-Received: by 2002:ac8:5743:: with SMTP id 3mr15993005qtx.38.1637153469669;
Wed, 17 Nov 2021 04:51:09 -0800 (PST)
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: Wed, 17 Nov 2021 04:51:09 -0800 (PST)
In-Reply-To: <20211117122258.781af131@t530>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Wed, 17 Nov 2021 12:51:09 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Nickolay Kolchin - Wed, 17 Nov 2021 12:51 UTC

On Wednesday, November 17, 2021 at 3:23:00 PM UTC+3, Jan Coombs wrote:
> On Wed, 17 Nov 2021 03:25:35 -0800 (PST)
> Nickolay Kolchin <nbko...@gmail.com> wrote:
>
> > On Wednesday, November 17, 2021 at 1:51:17 PM UTC+3, NN wrote:
> > > I came across this - its supposed to be a forth in python.
> > > The only thing forthy about it is it uses stacks and postfix.
> > >
> > > That said,I found it interesting and worth watching.
> > >
> > > https://www.youtube.com/playlist?list=PLpM-Dvs8t0VbMZA7wW9aR3EtBqe2kinu4
> >
> > IMHO, this is the second most stupid idea -- implementing forth in python.
> For speed it exports assembler text, assembles, and links to build
> an executable.
>
> For porth interaction/simulation pypy is 'strongly recommended'
> because this much faster than cython.
>
> More detail in the README.md:
> https://gitlab.com/tsoding/porth/-/blob/master/README.md
>
> Jan Coombs
> --

Still not convinced.

$ ./porth.py com euler/problem04.porth
[INFO] Generating euler/problem04.asm
[CMD] nasm -felf64 euler/problem04.asm
[CMD] ld -o euler/problem04 euler/problem04.o

$ time ./problem04
906609
real 0m0.042s
user 0m0.042s
sys 0m0.000s

$ time ./porth.py sim euler/problem04.porth
906609

real 4m39.338s
user 4m39.115s
sys 0m0.096s

$ time pypy3 ./porth.py sim euler/problem04.porth
906609

real 0m10.017s
user 0m9.919s
sys 0m0.030s

Re: porth

<87lf1mv8fz.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15274&group=comp.lang.forth#15274

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Wed, 17 Nov 2021 12:22:24 -0800
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <87lf1mv8fz.fsf@nightsong.com>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="55c7780f663b9d5c5067410ce1503f09";
logging-data="19851"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FY64GVAqVlaRLvTKTIdzH"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:T9HawFwV6s1MQw19wXPG9eQss7Y=
sha1:qmusdszjBlh9/i/X6Ld1GTPifpA=
 by: Paul Rubin - Wed, 17 Nov 2021 20:22 UTC

Nickolay Kolchin <nbkolchin@gmail.com> writes:
> $ ./porth.py com euler/problem04.porth ...
> $ time ./problem04
> 906609
> real 0m0.042s
> user 0m0.042s
> sys 0m0.000s

That doesn't look bad to me. Gforth is much slower, though my
implementation may have been worse than yours. Either nway, I'd count
Porth's compiled speed as more important than Python-simulated speed.

time gforth-fast euler04.fs
906609

real 0m0.249s
user 0m0.240s
sys 0m0.009s

Re: porth

<sn48kg$1b6j$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15275&group=comp.lang.forth#15275

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Thu, 18 Nov 2021 12:01:04 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sn48kg$1b6j$1@gioia.aioe.org>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="44243"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Thu, 18 Nov 2021 01:01 UTC

On 18/11/2021 07:22, Paul Rubin wrote:
> Nickolay Kolchin <nbkolchin@gmail.com> writes:
>> $ ./porth.py com euler/problem04.porth ...
>> $ time ./problem04
>> 906609
>> real 0m0.042s
>> user 0m0.042s
>> sys 0m0.000s
>
> That doesn't look bad to me. Gforth is much slower, though my
> implementation may have been worse than yours. Either nway, I'd count
> Porth's compiled speed as more important than Python-simulated speed.
>
> time gforth-fast euler04.fs
> 906609
>
> real 0m0.249s
> user 0m0.240s
> sys 0m0.009s
>

The bigger concern is the author's starting point:

"It's like Forth but written in Python. But I don't actually know for
sure since I never programmed in Forth, I only heard that it's some
sort of stack-based programming language."

He's going to encounter the same issues Moore did. Whether he has the
same resolve and ability to solve them remains to be seen.

Writing a HLL on top of another HLL has always bothered me as it's too
easy to hide poor solutions.

Re: porth

<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15276&group=comp.lang.forth#15276

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5794:: with SMTP id v20mr21833010qta.60.1637197364931;
Wed, 17 Nov 2021 17:02:44 -0800 (PST)
X-Received: by 2002:a05:6214:2505:: with SMTP id gf5mr59468399qvb.55.1637197364754;
Wed, 17 Nov 2021 17:02:44 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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: Wed, 17 Nov 2021 17:02:44 -0800 (PST)
In-Reply-To: <87lf1mv8fz.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Thu, 18 Nov 2021 01:02:44 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 65
 by: Nickolay Kolchin - Thu, 18 Nov 2021 01:02 UTC

On Wednesday, November 17, 2021 at 11:22:39 PM UTC+3, Paul Rubin wrote:
> Nickolay Kolchin <nbko...@gmail.com> writes:
> > $ ./porth.py com euler/problem04.porth ...
> > $ time ./problem04
> > 906609
> > real 0m0.042s
> > user 0m0.042s
> > sys 0m0.000s
> That doesn't look bad to me. Gforth is much slower, though my
> implementation may have been worse than yours. Either nway, I'd count
> Porth's compiled speed as more important than Python-simulated speed.
>
> time gforth-fast euler04.fs
> 906609
>
> real 0m0.249s
> user 0m0.240s
> sys 0m0.009s

My machine is probably faster.

$ time ~/tmp/gforth/gforth-fast euler04.fth
906609

real 0m0.041s
user 0m0.040s
sys 0m0.000s

- lxf: 0m0.017s
- SwiftForth: 0m0.020s
- Vfx32: 0m0.018s
- Vfx64: 0m0.019s
- flk: 0m0.016s

But that's not the point. 30000 times slowness in simulation mode can't be
just ignored. And pypy is "russian roulette", slight source change and it
suddenly runs slower then CPython.

\ direct porth source rewrite to normal forth
0 VALUE ans

: test
1000 100 ?DO
1000 100 ?DO
I J * DUP 0
BEGIN
OVER 0>
WHILE
10 *
OVER 10 MOD
+
SWAP 10 / SWAP
REPEAT
NIP
2DUP = IF
DUP ans > IF
DUP TO ans
THEN
THEN
2DROP
LOOP
LOOP
ans . CR
;

test BYE

Re: porth

<sn4gad$1dnp$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15278&group=comp.lang.forth#15278

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Thu, 18 Nov 2021 14:12:13 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sn4gad$1dnp$1@gioia.aioe.org>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="46841"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 18 Nov 2021 03:12 UTC

On 18/11/2021 12:02, Nickolay Kolchin wrote:
> On Wednesday, November 17, 2021 at 11:22:39 PM UTC+3, Paul Rubin wrote:
>> Nickolay Kolchin <nbko...@gmail.com> writes:
>> > $ ./porth.py com euler/problem04.porth ...
>> > $ time ./problem04
>> > 906609
>> > real 0m0.042s
>> > user 0m0.042s
>> > sys 0m0.000s
>> That doesn't look bad to me. Gforth is much slower, though my
>> implementation may have been worse than yours. Either nway, I'd count
>> Porth's compiled speed as more important than Python-simulated speed.
>>
>> time gforth-fast euler04.fs
>> 906609
>>
>> real 0m0.249s
>> user 0m0.240s
>> sys 0m0.009s
>
> My machine is probably faster.
>
> $ time ~/tmp/gforth/gforth-fast euler04.fth
> 906609
>
> real 0m0.041s
> user 0m0.040s
> sys 0m0.000s
>
> - lxf: 0m0.017s
> - SwiftForth: 0m0.020s
> - Vfx32: 0m0.018s
> - Vfx64: 0m0.019s
> - flk: 0m0.016s
>
> But that's not the point. 30000 times slowness in simulation mode can't be
> just ignored. And pypy is "russian roulette", slight source change and it
> suddenly runs slower then CPython.
>
> \ direct porth source rewrite to normal forth
> 0 VALUE ans
>
> : test
> 1000 100 ?DO
> 1000 100 ?DO
> I J * DUP 0
> BEGIN
> OVER 0>
> WHILE
> 10 *
> OVER 10 MOD
> +
> SWAP 10 / SWAP
> REPEAT
> NIP
> 2DUP = IF
> DUP ans > IF
> DUP TO ans
> THEN
> THEN
> 2DROP
> LOOP
> LOOP
> ans . CR
> ;
>
> test BYE

A little neater - not necessarily faster:

: test
1000 100 DO
1000 100 DO
I J * DUP 0
BEGIN
OVER 0>
WHILE
10 * >R 10 /MOD SWAP R> +
REPEAT NIP
2DUP = IF
DUP ans MAX TO ans
THEN 2DROP
LOOP
LOOP
ans . CR
;

Re: porth

<a4313d05-16e7-421f-9f46-84667545b486n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15280&group=comp.lang.forth#15280

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:2c9:: with SMTP id a9mr24927563qtx.28.1637237885112;
Thu, 18 Nov 2021 04:18:05 -0800 (PST)
X-Received: by 2002:a05:622a:391:: with SMTP id j17mr26112032qtx.228.1637237884961;
Thu, 18 Nov 2021 04:18:04 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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: Thu, 18 Nov 2021 04:18:04 -0800 (PST)
In-Reply-To: <dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:4063:16fa:9ced:54e9;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:4063:16fa:9ced:54e9
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a4313d05-16e7-421f-9f46-84667545b486n@googlegroups.com>
Subject: Re: porth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Thu, 18 Nov 2021 12:18:05 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 36
 by: Marcel Hendrix - Thu, 18 Nov 2021 12:18 UTC

On Thursday, November 18, 2021 at 2:02:45 AM UTC+1, Nickolay Kolchin wrote:
> \ direct porth source rewrite to normal forth
> 0 VALUE ans
>
> : test
> 1000 100 ?DO
> 1000 100 ?DO
> I J * DUP 0
> BEGIN
> OVER 0>
> WHILE
> 10 *
> OVER 10 MOD
> +
> SWAP 10 / SWAP
> REPEAT
> NIP
> 2DUP = IF
> DUP ans > IF
> DUP TO ans
> THEN
> THEN
> 2DROP
> LOOP
> LOOP
> ans . CR
> ;
>
> test BYE

FORTH> : tt timer-reset test space .elapsed ; ok
FORTH> tt 906609
0.009 seconds elapsed. ok
FORTH> .ticker-info
AMD Ryzen 7 5800X 8-Core Processor, TICKS-GET uses iTSC at 4192MHz

-marcel

Re: porth

<6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15281&group=comp.lang.forth#15281

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:5bc4:: with SMTP id t4mr64374751qvt.3.1637238461201;
Thu, 18 Nov 2021 04:27:41 -0800 (PST)
X-Received: by 2002:a05:622a:130f:: with SMTP id v15mr25473786qtk.122.1637238461082;
Thu, 18 Nov 2021 04:27:41 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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: Thu, 18 Nov 2021 04:27:40 -0800 (PST)
In-Reply-To: <sn4gad$1dnp$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:4063:16fa:9ced:54e9;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:4063:16fa:9ced:54e9
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com> <sn4gad$1dnp$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com>
Subject: Re: porth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Thu, 18 Nov 2021 12:27:41 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 19
 by: Marcel Hendrix - Thu, 18 Nov 2021 12:27 UTC

On Thursday, November 18, 2021 at 4:12:16 AM UTC+1, dxforth wrote:
[..]
FORTH> : test 1000 100 DO
[3]<3>[FORTH>] 1000 100 DO
[6]<3>[FORTH>] I J * DUP 0
[6]<3>[FORTH>] BEGIN OVER 0>
[9]<3>[FORTH>] WHILE 10 * >R 10 /MOD SWAP R> +
[12]<3>[FORTH>] REPEAT NIP
[6]<3>[FORTH>] 2DUP = IF DUP ans MAX TO ans THEN 2DROP
[6]<3>[FORTH>] LOOP
[3]<3>[FORTH>] LOOP ; ok
FORTH> ok
FORTH> : tt cr timer-reset 100 0 do test loop .elapsed space ans . ; ok
FORTH> test test test ok
FORTH> tt tt tt
0.811 seconds elapsed. 906609
0.811 seconds elapsed. 906609
0.812 seconds elapsed. 906609 ok

-marcel

Re: porth

<2021Nov18.171720@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15282&group=comp.lang.forth#15282

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Thu, 18 Nov 2021 16:17:20 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 110
Message-ID: <2021Nov18.171720@mips.complang.tuwien.ac.at>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com> <de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530> <23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com> <dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="ba1b0116195cc058d854936b1770e51f";
logging-data="30583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dDAZpRhQDBl41lch4/nB3"
Cancel-Lock: sha1:iGVASdI5EMyN7cr3YOf5XOncKnI=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 18 Nov 2021 16:17 UTC

Nickolay Kolchin <nbkolchin@gmail.com> writes:
>On Wednesday, November 17, 2021 at 11:22:39 PM UTC+3, Paul Rubin wrote:
>> time gforth-fast euler04.fs
>> 906609
>>
>> real 0m0.249s
>> user 0m0.240s
>> sys 0m0.009s
>
>My machine is probably faster.
>
>$ time ~/tmp/gforth/gforth-fast euler04.fth
>906609
>
>real 0m0.041s
>user 0m0.040s
>sys 0m0.000s

Or/and you are using a different version of Gforth.

Numbers below from a 4GHz Skylake (Core i5-6600K), explanations below:

cycles:u s user
181,830,977 0.049 gforth-fast 0.7.9_20211111
229,629,657 0.061 gforth-fast 0.7.9_20211111 --no-dynamic
367,998,341 0.096 gforth-fast 0.7.9_20211111 -e "' fold2-1 folds / mod"
416,948,313 0.108 gforth-fast 0.7.9_20211111 --no-dynamic -e "' fold2-1 folds / mod"
412,787,818 0.107 gforth-fast 0.7.3
173,343,023 0.044 gforth-fast 0.6.2 (32-bit)
364,124,093 0.095 gforth-fast -e "' /s alias / ' mods alias mod"
122,955,447 0.031 lxf
129,094,238 0.036 vfxlin 4.72
139,616,441 0.038 sf 3.11.0
327,688,281 0.103 flk

We see that gforth-fast 0.7.3 is more than twice as slow as
0.7.9_20211111. Why? One reason is that for the build of 0.7.3 that
I used, a sanity check disabled dynamic native code generation. To
simulate this with 0.7.9_20211111, I disabled dynamic native code
generation with --no-dynamic.

But that's not the whole story. One difference between 0.7.3 and
0.7.9_20211111 is that 0.7.9 optimizes division by constants. I
disabled this optimization with -e "' fold2-1 folds / mod" (which
still performs constant folding on / and mod, but that does not play a
role here). This optimization seems to have a big influence on
Gforth performance.

The combination of these two disablings is close enough to the 0.7.3
results to explain the difference.

However, the other results are somewhat mysterious. The gforth 0.6.2
system I measured had dynamic native code generation, but no
optimization of /. If / and mod are so slow, why is 0.6.2 (which does
not optimize them) so fast. If the 32-bitness plays a role, one would
expect a 64-bit Forth that does not optimize division by constant to
also see a big slowdown compared to its 32-bit variant, but we don't
see it:

>- Vfx32: 0m0.018s
>- Vfx64: 0m0.019s

I also tested symmetric (rather than floored) division with -e "' /s
alias / ' mods alias mod", but performance is similar to the
unoptimized floored version (Gforth has no optimization for /S and
MODS).

My FLK results are quite different from what you reported:

>- lxf: 0m0.017s
>- SwiftForth: 0m0.020s
>- Vfx32: 0m0.018s
>- Vfx64: 0m0.019s
>- flk: 0m0.016s
....
>\ direct porth source rewrite to normal forth
>0 VALUE ans
>
>: test
> 1000 100 ?DO
> 1000 100 ?DO
> I J * DUP 0
> BEGIN
> OVER 0>
> WHILE
> 10 *
> OVER 10 MOD
> +
> SWAP 10 / SWAP
> REPEAT
> NIP
> 2DUP = IF
> DUP ans > IF
> DUP TO ans
> THEN
> THEN
> 2DROP
> LOOP
> LOOP
> ans . CR
>;
>
>test BYE

- 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 2021: https://euro.theforth.net/2021

Re: porth

<b4ee0c0f-b2d0-40f8-94fe-8965478ebd1fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15283&group=comp.lang.forth#15283

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7dc5:: with SMTP id c5mr13371343qte.264.1637259566649;
Thu, 18 Nov 2021 10:19:26 -0800 (PST)
X-Received: by 2002:ad4:4f2e:: with SMTP id fc14mr67144397qvb.66.1637259566424;
Thu, 18 Nov 2021 10:19:26 -0800 (PST)
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: Thu, 18 Nov 2021 10:19:26 -0800 (PST)
In-Reply-To: <2021Nov18.171720@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com> <2021Nov18.171720@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b4ee0c0f-b2d0-40f8-94fe-8965478ebd1fn@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Thu, 18 Nov 2021 18:19:26 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Nickolay Kolchin - Thu, 18 Nov 2021 18:19 UTC

On Thursday, November 18, 2021 at 8:20:03 PM UTC+3, Anton Ertl wrote:
> Nickolay Kolchin <nbko...@gmail.com> writes:
> >On Wednesday, November 17, 2021 at 11:22:39 PM UTC+3, Paul Rubin wrote:
> >> time gforth-fast euler04.fs
> >> 906609
> >>
> >> real 0m0.249s
> >> user 0m0.240s
> >> sys 0m0.009s
> >
> >My machine is probably faster.
> >
> >$ time ~/tmp/gforth/gforth-fast euler04.fth
> >906609
> >
> >real 0m0.041s
> >user 0m0.040s
> >sys 0m0.000s
> Or/and you are using a different version of Gforth.
>
> Numbers below from a 4GHz Skylake (Core i5-6600K), explanations below:
>
> cycles:u s user
> 181,830,977 0.049 gforth-fast 0.7.9_20211111
> 229,629,657 0.061 gforth-fast 0.7.9_20211111 --no-dynamic
> 367,998,341 0.096 gforth-fast 0.7.9_20211111 -e "' fold2-1 folds / mod"
> 416,948,313 0.108 gforth-fast 0.7.9_20211111 --no-dynamic -e "' fold2-1 folds / mod"
> 412,787,818 0.107 gforth-fast 0.7.3
> 173,343,023 0.044 gforth-fast 0.6.2 (32-bit)
> 364,124,093 0.095 gforth-fast -e "' /s alias / ' mods alias mod"
> 122,955,447 0.031 lxf
> 129,094,238 0.036 vfxlin 4.72
> 139,616,441 0.038 sf 3.11.0
> 327,688,281 0.103 flk
>
> We see that gforth-fast 0.7.3 is more than twice as slow as
> 0.7.9_20211111. Why? One reason is that for the build of 0.7.3 that
> I used, a sanity check disabled dynamic native code generation. To
> simulate this with 0.7.9_20211111, I disabled dynamic native code
> generation with --no-dynamic.
>
> But that's not the whole story. One difference between 0.7.3 and
> 0.7.9_20211111 is that 0.7.9 optimizes division by constants. I
> disabled this optimization with -e "' fold2-1 folds / mod" (which
> still performs constant folding on / and mod, but that does not play a
> role here). This optimization seems to have a big influence on
> Gforth performance.
>
> The combination of these two disablings is close enough to the 0.7.3
> results to explain the difference.
>
> However, the other results are somewhat mysterious. The gforth 0.6.2
> system I measured had dynamic native code generation, but no
> optimization of /. If / and mod are so slow, why is 0.6.2 (which does
> not optimize them) so fast. If the 32-bitness plays a role, one would
> expect a 64-bit Forth that does not optimize division by constant to
> also see a big slowdown compared to its 32-bit variant, but we don't
> see it:
> >- Vfx32: 0m0.018s
> >- Vfx64: 0m0.019s
> I also tested symmetric (rather than floored) division with -e "' /s
> alias / ' mods alias mod", but performance is similar to the
> unoptimized floored version (Gforth has no optimization for /S and
> MODS).
>
> My FLK results are quite different from what you reported:
> >- lxf: 0m0.017s
> >- SwiftForth: 0m0.020s
> >- Vfx32: 0m0.018s
> >- Vfx64: 0m0.019s
> >- flk: 0m0.016s
> ...

The difference probably comes from Intel vs AMD.

If I remember correctly you are testing with

"perf stat -e cycles:u -e instructions:u"

Here are results from my machine (amd5950x):

Porth variant:

- porth: 184,283,728; 509,449,073; 0.040098456
- gforth-0.7.3: 606,877,605; 1,430,796,757; 0.127517408
- gforth-fast-0.7.3: 752,358,649; 1,474,773,380; 0.155099806
- gforth 0.7.9_20211104: 405,620,747; 705,471,017; 0.089281093
- gforth-fast 0.7.9_20211104: 177,980,717; 580,122,080; 0.039897830
- lxf: 77,205,380; 81,747,059; 0.017932932
- SwiftForth: 86,075,993; 141,327,609; 0.020731892
- vfxlin32: 80,978,827; 93,408,992; 0.017410421
- vfxlin64: 87,491,736; 89,573,526; 0.018919114
- spf4: 78,587,843; 119,558,838; 0.017927621
- flk: 64,926,664; 158,114,169; 0.014062649
- ikforth: 821,123,562; 1,203,932,090; 0.202385445

Dxforth variant:

- gforth-0.7.3: 493,523,584; 1,170,771,711; 0.105020759
- gforth-fast-0.7.3: 584,927,618; 1,225,635,106; 0.124608806
- gforth 0.7.9_20211104: 333,189,391; 0.071537956
- gforth-fast 0.7.9_20211104: 138,684,586; 420,304,321; 0.030887929
- lxf: 40,495,387; 68,372,324; 0.010463832
- SwiftForth: 60,211,454; 98,827,718; 0.014094500
- vfxlin32: 50,611,681; 83,933,758; 0.011637347
- vfxlin64: 52,111,299; 80,123,961; 0.013099529
- spf4: 42,827,585; 81,697,379; 0.010892942
- flk: 54,357,589; 189,642,139; 0.013351736
- ikforth: 517,799,517; 787,688,329; 0.201992826

I don't really understand why you find gforth 0.7.3 vs 0.7.9
performance difference surprising. All tests I run show 2-10 times
improvement for 0.7.9. (time to make release, eh?)

flk generates simple code that executes at almost 4 insn per cycle.

Porth with -e "' /s alias / ' mods alias mod"

- gforth-fast 0.7.9: 143,820,949; 448,040,922; 0.033915253

Porth with -e "' fold2-1 folds / mod"

- gforth-fast 0.7.9: 153,789,784; 452,753,589; 0.035525458

Re: porth

<87zgq1tazx.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15287&group=comp.lang.forth#15287

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Thu, 18 Nov 2021 13:22:26 -0800
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <87zgq1tazx.fsf@nightsong.com>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="9ec14a6261c6c137d7be578011d1b2d2";
logging-data="2888"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eG3stuN0nF6o3/VVYpgXk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:Xnne0qKrOD9MwlLIafuSAJvSdVo=
sha1:dnCeOrher4NPSPv2O61W+hStHPA=
 by: Paul Rubin - Thu, 18 Nov 2021 21:22 UTC

Nickolay Kolchin <nbkolchin@gmail.com> writes:
> My machine is probably faster.
> $ time ~/tmp/gforth/gforth-fast euler04.fth
> 906609
>
> real 0m0.041s
> user 0m0.040s
> sys 0m0.000s

I think your Forth program has less overhead than mine. I did a little
tweaking of my version (below) and ran it on a faster machine (i5-3570S
3.10 ghz instead of my laptop which which is somewhat slower) and I
still get (gforth 0.7.3 Debian package):

$ time gforth-fast euler04.fs
906609

real 0m0.127s
user 0m0.124s
sys 0m0.000s

================================================================
#! /usr/bin/gforth
: palindrome?.1 ( n m1 m2 -- flag )
2>r dup r> / 10 mod swap r> / 10 mod = ;
: palindrome? ( n -- flag ) >r
r@ 100000 1 palindrome?.1
r@ 10000 10 palindrome?.1
r> 1000 100 palindrome?.1
AND AND ;

0 VALUE answer
: euler04 1000 100 DO
i 1+ 100 DO
i j * DUP palindrome? IF
answer MAX TO answer
ELSE drop
THEN
LOOP
LOOP answer ;

euler04 . cr
bye

Re: porth

<87r1bdta07.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15288&group=comp.lang.forth#15288

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Thu, 18 Nov 2021 13:43:52 -0800
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <87r1bdta07.fsf@nightsong.com>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com> <sn48kg$1b6j$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="9ec14a6261c6c137d7be578011d1b2d2";
logging-data="2888"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+W9PNcV74rsebVFF2C7qem"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:m0bxXes4XaE8ke+qg91K1O8P25E=
sha1:RDiB6OS5soHoWAkA/kgCEP/9tG8=
 by: Paul Rubin - Thu, 18 Nov 2021 21:43 UTC

dxforth <dxforth@gmail.com> writes:
> The bigger concern is the author's starting point:
>
> "It's like Forth but written in Python. But I don't actually know for
> sure since I never programmed in Forth, I only heard that it's some
> sort of stack-based programming language."

You may be onto something there. Implementing Forth without first
actually understanding Forth is a classic antipattern.

> He's going to encounter the same issues Moore did. Whether he has the
> same resolve and ability to solve them remains to be seen.

Moore had certain constraints to deal with, and the solution he reached
was inventing Forth. Certainly someone using Python and modern
computers doesn't have the same constraints. So if they reach the same
solution, something is suspicious.

> Writing a HLL on top of another HLL has always bothered me as it's too
> easy to hide poor solutions.

HLL's make most things easier so I don't see anything wrong in principle
with using them for language implementation, particularly implementing
compilers. I'm not too bothered by the huge slowdown in the simulated
version if the real target is supposed to be the compiler. It's sort of
like running a hardware design under simulation. You'd use the
simulator for certain types of functional testing and debugging, not for
running actual application workloads.

Re: porth

<d6ec2615-a92d-45d3-9ed3-daa215048e63n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15289&group=comp.lang.forth#15289

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:a956:: with SMTP id s83mr23912461qke.422.1637272204577;
Thu, 18 Nov 2021 13:50:04 -0800 (PST)
X-Received: by 2002:a05:620a:14a3:: with SMTP id x3mr23916421qkj.286.1637272204398;
Thu, 18 Nov 2021 13:50:04 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.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: Thu, 18 Nov 2021 13:50:04 -0800 (PST)
In-Reply-To: <87zgq1tazx.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com> <87zgq1tazx.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d6ec2615-a92d-45d3-9ed3-daa215048e63n@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Thu, 18 Nov 2021 21:50:04 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 74
 by: Nickolay Kolchin - Thu, 18 Nov 2021 21:50 UTC

On Friday, November 19, 2021 at 12:22:28 AM UTC+3, Paul Rubin wrote:
> Nickolay Kolchin <nbko...@gmail.com> writes:
> > My machine is probably faster.
> > $ time ~/tmp/gforth/gforth-fast euler04.fth
> > 906609
> >
> > real 0m0.041s
> > user 0m0.040s
> > sys 0m0.000s
> I think your Forth program has less overhead than mine. I did a little
> tweaking of my version (below) and ran it on a faster machine (i5-3570S
> 3.10 ghz instead of my laptop which which is somewhat slower) and I
> still get (gforth 0.7.3 Debian package):
>
> $ time gforth-fast euler04.fs
> 906609
>
> real 0m0.127s
> user 0m0.124s
> sys 0m0.000s
>
> ================================================================
> #! /usr/bin/gforth
> : palindrome?.1 ( n m1 m2 -- flag )
> 2>r dup r> / 10 mod swap r> / 10 mod = ;
> : palindrome? ( n -- flag ) >r
> r@ 100000 1 palindrome?.1
> r@ 10000 10 palindrome?.1
> r> 1000 100 palindrome?.1
> AND AND ;
>
> 0 VALUE answer
> : euler04 1000 100 DO
> i 1+ 100 DO
> i j * DUP palindrome? IF
> answer MAX TO answer
> ELSE drop
> THEN
> LOOP
> LOOP answer ;
>
> euler04 . cr
> bye

This is not my program! I've just converted porth source to forth. Timings for
your version on my machine against dxforth variant with gforth 0.7.3:

$ perf stat -e cycles:u -e instructions:u -e branches:u gforth-fast euler04-dxforth.fth
906609

Performance counter stats for 'gforth-fast euler04-dxforth.fth':

680,066,582 cycles:u
1,347,282,943 instructions:u # 1.98 insn per cycle
166,991,379 branches:u

0.144651185 seconds time elapsed

0.144367000 seconds user
0.000000000 seconds sys

$ perf stat -e cycles:u -e instructions:u -e branches:u gforth-fast euler04-rubin.fth
906609

Performance counter stats for 'gforth-fast euler04-rubin.fth':

226,337,138 cycles:u
534,818,702 instructions:u # 2.36 insn per cycle
64,907,310 branches:u

0.049622518 seconds time elapsed

0.049379000 seconds user
0.000000000 seconds sys

Re: porth

<sn6thi$1c7m$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15291&group=comp.lang.forth#15291

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Fri, 19 Nov 2021 12:10:11 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sn6thi$1c7m$1@gioia.aioe.org>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com> <sn48kg$1b6j$1@gioia.aioe.org>
<87r1bdta07.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="45302"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 19 Nov 2021 01:10 UTC

On 19/11/2021 08:43, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> The bigger concern is the author's starting point:
>>
>> "It's like Forth but written in Python. But I don't actually know for
>> sure since I never programmed in Forth, I only heard that it's some
>> sort of stack-based programming language."
>
> You may be onto something there. Implementing Forth without first
> actually understanding Forth is a classic antipattern.
>
>> He's going to encounter the same issues Moore did. Whether he has the
>> same resolve and ability to solve them remains to be seen.
>
> Moore had certain constraints to deal with, and the solution he reached
> was inventing Forth. Certainly someone using Python and modern
> computers doesn't have the same constraints. So if they reach the same
> solution, something is suspicious.

Languages have the same goal - irreducible simplicity. In selecting a
stack-based language the definition of 'simplicity' narrows. Suspicion
is if they didn't reach the same conclusions.

>> Writing a HLL on top of another HLL has always bothered me as it's too
>> easy to hide poor solutions.
>
> HLL's make most things easier so I don't see anything wrong in principle
> with using them for language implementation, particularly implementing
> compilers. I'm not too bothered by the huge slowdown in the simulated
> version if the real target is supposed to be the compiler. It's sort of
> like running a hardware design under simulation. You'd use the
> simulator for certain types of functional testing and debugging, not for
> running actual application workloads.

When you write Forth in C - which language are you really promoting?

Re: porth

<sn9c8b$146q$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15292&group=comp.lang.forth#15292

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Sat, 20 Nov 2021 10:33:33 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sn9c8b$146q$1@gioia.aioe.org>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
<sn4gad$1dnp$1@gioia.aioe.org>
<6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="37082"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 19 Nov 2021 23:33 UTC

On 18/11/2021 23:27, Marcel Hendrix wrote:
> On Thursday, November 18, 2021 at 4:12:16 AM UTC+1, dxforth wrote:
> [..]
> FORTH> : test 1000 100 DO
> [3]<3>[FORTH>] 1000 100 DO
> [6]<3>[FORTH>] I J * DUP 0
> [6]<3>[FORTH>] BEGIN OVER 0>
> [9]<3>[FORTH>] WHILE 10 * >R 10 /MOD SWAP R> +
> [12]<3>[FORTH>] REPEAT NIP
> [6]<3>[FORTH>] 2DUP = IF DUP ans MAX TO ans THEN 2DROP
> [6]<3>[FORTH>] LOOP
> [3]<3>[FORTH>] LOOP ; ok
> FORTH> ok
> FORTH> : tt cr timer-reset 100 0 do test loop .elapsed space ans . ; ok
> FORTH> test test test ok
> FORTH> tt tt tt
> 0.811 seconds elapsed. 906609
> 0.811 seconds elapsed. 906609
> 0.812 seconds elapsed. 906609 ok

Compared to?

On VFX32 i5-7400 I get 50% improvement over the original.
As the code is dominated by multiplications and divisions,
halving the latter should have some impact.

Re: porth

<87mtlztwcy.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15293&group=comp.lang.forth#15293

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Fri, 19 Nov 2021 18:05:33 -0800
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <87mtlztwcy.fsf@nightsong.com>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com> <sn48kg$1b6j$1@gioia.aioe.org>
<87r1bdta07.fsf@nightsong.com> <sn6thi$1c7m$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="669718e05613edaaadb2941a40f52f01";
logging-data="13155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mfYxHNXMsPNRnIsmMSqqh"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:EcNxjoI8AXvKGz0lO76uqxItjfs=
sha1:Bqp/D0G9GXzYnhrq/UXDH8ICisA=
 by: Paul Rubin - Sat, 20 Nov 2021 02:05 UTC

dxforth <dxforth@gmail.com> writes:
> Languages have the same goal - irreducible simplicity. In selecting a
> stack-based language the definition of 'simplicity' narrows. Suspicion
> is if they didn't reach the same conclusions.

I thought the goal of languages was to decrease the cognitive burden of
writing programs that are reliable, efficient, and maintainable, and
maybe some other attributes as well. That is a multi-way tradeoff, and
consumption of machine resources is another resource that has to be
traded off.

In Moore's era, machine resources were scarce (so there was more premium
on conserving them), programs had to be small (there was less need for
the language to help manage their complexity, since they were less
complex to begin with); and also because they were small, they could be
made reliable with a manageable amount of debugging and testing without
too much help from the language.

Forth reflects all those factors: it emphasizes simplicity and
compactness over (for example) fancier error-checking such as a type
system. Also, its driving applications involved realtime control
(telescopes etc.) so it couldn't have random delays for garbage
collection, even if enough memory was available for that.

> When you write Forth in C - which language are you really promoting?

Forth is something of a special case these days, since I think it is
used for "spiritual" reasons as well as technical ones. So writing
Forth in C seems sinful. C is not special like Forth is though: it's
good for some things, but writing compilers is not one of them. Writing
a C compiler in C these days is just a poor technical choice. The two
main current C compilers (GCC and Clang) are written in C++ now, and the
most reliable one (CompCert) is written in Coq, basically an Ocaml
dialect emphasizing theorem proving to make sure the program is correct.

I'm not a believer in one language to rule them all. Different problems
call for different approaches.

Re: porth

<aa5ba40d-47fd-47c6-b861-2ee44e2585a3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15295&group=comp.lang.forth#15295

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:462b:: with SMTP id br43mr33980353qkb.465.1637402359637;
Sat, 20 Nov 2021 01:59:19 -0800 (PST)
X-Received: by 2002:ac8:5b87:: with SMTP id a7mr13755957qta.196.1637402359503;
Sat, 20 Nov 2021 01:59:19 -0800 (PST)
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, 20 Nov 2021 01:59:19 -0800 (PST)
In-Reply-To: <sn9c8b$146q$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:a579:4c0a:e0a6:6e39;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:a579:4c0a:e0a6:6e39
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com> <sn4gad$1dnp$1@gioia.aioe.org>
<6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com> <sn9c8b$146q$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aa5ba40d-47fd-47c6-b861-2ee44e2585a3n@googlegroups.com>
Subject: Re: porth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sat, 20 Nov 2021 09:59:19 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Marcel Hendrix - Sat, 20 Nov 2021 09:59 UTC

On Saturday, November 20, 2021 at 12:33:37 AM UTC+1, dxforth wrote:
> On 18/11/2021 23:27, Marcel Hendrix wrote:
> > On Thursday, November 18, 2021 at 4:12:16 AM UTC+1, dxforth wrote:
> > [..]
> > FORTH> : test 1000 100 DO
> > [3]<3>[FORTH>] 1000 100 DO
> > [6]<3>[FORTH>] I J * DUP 0
> > [6]<3>[FORTH>] BEGIN OVER 0>
> > [9]<3>[FORTH>] WHILE 10 * >R 10 /MOD SWAP R> +
> > [12]<3>[FORTH>] REPEAT NIP
> > [6]<3>[FORTH>] 2DUP = IF DUP ans MAX TO ans THEN 2DROP
> > [6]<3>[FORTH>] LOOP
> > [3]<3>[FORTH>] LOOP ; ok
> > FORTH> ok
> > FORTH> : tt cr timer-reset 100 0 do test loop .elapsed space ans . ; ok
> > FORTH> test test test ok
> > FORTH> tt tt tt
> > 0.811 seconds elapsed. 906609
> > 0.811 seconds elapsed. 906609
> > 0.812 seconds elapsed. 906609 ok
> Compared to?
>
> On VFX32 i5-7400 I get 50% improvement over the original.
> As the code is dominated by multiplications and divisions,
> halving the latter should have some impact.

Compared to the original algorithm that I showed for iForth64 on
the same hardware (9ms for a single run => 0.900 seconds for 100x).
There appears to be an 11% speed improvement.

-marcel

Re: porth

<87ee7bt8tg.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15296&group=comp.lang.forth#15296

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Sat, 20 Nov 2021 02:34:03 -0800
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <87ee7bt8tg.fsf@nightsong.com>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
<sn4gad$1dnp$1@gioia.aioe.org>
<6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com>
<sn9c8b$146q$1@gioia.aioe.org>
<aa5ba40d-47fd-47c6-b861-2ee44e2585a3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="669718e05613edaaadb2941a40f52f01";
logging-data="16136"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19je9zLaw2KifY+sVsVkIx8"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:nbkd4qS8u31TOdBq69cE7krlYwo=
sha1:WkrZYyDuBEBiT2rZtbMkJbNOyk8=
 by: Paul Rubin - Sat, 20 Nov 2021 10:34 UTC

Marcel Hendrix <mhx@iae.nl> writes:
>> > FORTH> : test 1000 100 DO
>> > [3]<3>[FORTH>] 1000 100 DO
>> > [6]<3>[FORTH>] I J * ...

> Compared to the original algorithm that I showed for iForth64 on
> the same hardware (9ms for a single run => 0.900 seconds for 100x).
> There appears to be an 11% speed improvement.

Am I missing something dumb, or is there an obvious 50% improvement by
just making the inner loop run from I to 1000 instead of 100 to 1000?
If you have already tested the pair 200,300 there is no need to test
300,200.

Re: porth

<snakuj$65g$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15297&group=comp.lang.forth#15297

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Sat, 20 Nov 2021 22:08:02 +1100
Organization: Aioe.org NNTP Server
Message-ID: <snakuj$65g$1@gioia.aioe.org>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
<20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com>
<87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com>
<sn4gad$1dnp$1@gioia.aioe.org>
<6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com>
<sn9c8b$146q$1@gioia.aioe.org>
<aa5ba40d-47fd-47c6-b861-2ee44e2585a3n@googlegroups.com>
<87ee7bt8tg.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="6320"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Sat, 20 Nov 2021 11:08 UTC

On 20/11/2021 21:34, Paul Rubin wrote:
> Marcel Hendrix <mhx@iae.nl> writes:
>>> > FORTH> : test 1000 100 DO
>>> > [3]<3>[FORTH>] 1000 100 DO
>>> > [6]<3>[FORTH>] I J * ...
>
>> Compared to the original algorithm that I showed for iForth64 on
>> the same hardware (9ms for a single run => 0.900 seconds for 100x).
>> There appears to be an 11% speed improvement.
>
> Am I missing something dumb, or is there an obvious 50% improvement by
> just making the inner loop run from I to 1000 instead of 100 to 1000?
> If you have already tested the pair 200,300 there is no need to test
> 300,200.

I didn't alter the algorithm. OTOH I was running a 32-bit forth on a
64-bit - enough to get a different result?

Re: porth

<a9348fdc-cd78-4695-9060-195184186268n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15298&group=comp.lang.forth#15298

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:2cc:: with SMTP id a12mr14374642qtx.101.1637406866801;
Sat, 20 Nov 2021 03:14:26 -0800 (PST)
X-Received: by 2002:ad4:5002:: with SMTP id s2mr83440266qvo.13.1637406866632;
Sat, 20 Nov 2021 03:14:26 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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, 20 Nov 2021 03:14:26 -0800 (PST)
In-Reply-To: <snakuj$65g$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530>
<23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com>
<dd0090f0-92cf-4f02-a8df-0e0ed91bc07bn@googlegroups.com> <sn4gad$1dnp$1@gioia.aioe.org>
<6f1a6d9e-49fb-4409-ad06-b23e346461e6n@googlegroups.com> <sn9c8b$146q$1@gioia.aioe.org>
<aa5ba40d-47fd-47c6-b861-2ee44e2585a3n@googlegroups.com> <87ee7bt8tg.fsf@nightsong.com>
<snakuj$65g$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a9348fdc-cd78-4695-9060-195184186268n@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Sat, 20 Nov 2021 11:14:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: Nickolay Kolchin - Sat, 20 Nov 2021 11:14 UTC

On Saturday, November 20, 2021 at 2:08:08 PM UTC+3, dxforth wrote:
> On 20/11/2021 21:34, Paul Rubin wrote:
> > Marcel Hendrix <m...@iae.nl> writes:
> >>> > FORTH> : test 1000 100 DO
> >>> > [3]<3>[FORTH>] 1000 100 DO
> >>> > [6]<3>[FORTH>] I J * ...
> >
> >> Compared to the original algorithm that I showed for iForth64 on
> >> the same hardware (9ms for a single run => 0.900 seconds for 100x).
> >> There appears to be an 11% speed improvement.
> >
> > Am I missing something dumb, or is there an obvious 50% improvement by
> > just making the inner loop run from I to 1000 instead of 100 to 1000?
> > If you have already tested the pair 200,300 there is no need to test
> > 300,200.
> I didn't alter the algorithm. OTOH I was running a 32-bit forth on a
> 64-bit - enough to get a different result?

No.

Re: porth

<1deebe05-a37b-4cdc-ab24-bc19f8b1ad44n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15299&group=comp.lang.forth#15299

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:8cb:: with SMTP id da11mr84300782qvb.62.1637418530255;
Sat, 20 Nov 2021 06:28:50 -0800 (PST)
X-Received: by 2002:ad4:5762:: with SMTP id r2mr83219301qvx.31.1637418530125;
Sat, 20 Nov 2021 06:28:50 -0800 (PST)
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, 20 Nov 2021 06:28:49 -0800 (PST)
In-Reply-To: <de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.138.223.107; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.138.223.107
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com> <de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1deebe05-a37b-4cdc-ab24-bc19f8b1ad44n@googlegroups.com>
Subject: Re: porth
From: gnuarm.d...@gmail.com (Rick C)
Injection-Date: Sat, 20 Nov 2021 14:28:50 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Rick C - Sat, 20 Nov 2021 14:28 UTC

On Wednesday, November 17, 2021 at 7:25:36 AM UTC-4, Nickolay Kolchin wrote:
> On Wednesday, November 17, 2021 at 1:51:17 PM UTC+3, NN wrote:
> > I came across this - its supposed to be a forth in python.
> > The only thing forthy about it is it uses stacks and postfix.
> >
> > That said,I found it interesting and worth watching.
> >
> > https://www.youtube.com/playlist?list=PLpM-Dvs8t0VbMZA7wW9aR3EtBqe2kinu4
> IMHO, this is the second most stupid idea -- implementing forth in python.

Of course, that begs the question, what is the first most stupid idea? Python in Forth perhaps?

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: porth

<dca8b0c0-0a83-49bb-8ca4-ae8e98e84b43n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15301&group=comp.lang.forth#15301

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:11b0:: with SMTP id c16mr35997566qkk.354.1637421069036;
Sat, 20 Nov 2021 07:11:09 -0800 (PST)
X-Received: by 2002:ac8:19:: with SMTP id a25mr15706021qtg.360.1637421068839;
Sat, 20 Nov 2021 07:11:08 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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, 20 Nov 2021 07:11:08 -0800 (PST)
In-Reply-To: <1deebe05-a37b-4cdc-ab24-bc19f8b1ad44n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com>
<de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <1deebe05-a37b-4cdc-ab24-bc19f8b1ad44n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dca8b0c0-0a83-49bb-8ca4-ae8e98e84b43n@googlegroups.com>
Subject: Re: porth
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Sat, 20 Nov 2021 15:11:09 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: Nickolay Kolchin - Sat, 20 Nov 2021 15:11 UTC

On Saturday, November 20, 2021 at 5:28:50 PM UTC+3, gnuarm.del...@gmail.com wrote:
> On Wednesday, November 17, 2021 at 7:25:36 AM UTC-4, Nickolay Kolchin wrote:
> > On Wednesday, November 17, 2021 at 1:51:17 PM UTC+3, NN wrote:
> > > I came across this - its supposed to be a forth in python.
> > > The only thing forthy about it is it uses stacks and postfix.
> > >
> > > That said,I found it interesting and worth watching.
> > >
> > > https://www.youtube.com/playlist?list=PLpM-Dvs8t0VbMZA7wW9aR3EtBqe2kinu4
> > IMHO, this is the second most stupid idea -- implementing forth in python.
> Of course, that begs the question, what is the first most stupid idea? Python in Forth perhaps?
>

Implementing Forth in R.

Re: porth

<snbdnu$i6f$1@z-news.wcss.wroc.pl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15304&group=comp.lang.forth#15304

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.lang.forth
Subject: Re: porth
Date: Sat, 20 Nov 2021 18:11:10 +0000 (UTC)
Organization: Politechnika Wroclawska
Lines: 50
Message-ID: <snbdnu$i6f$1@z-news.wcss.wroc.pl>
References: <87524765-8339-41fc-b18c-44dde872d486n@googlegroups.com> <de6d4bbe-761e-462f-8941-aca4f9f4b5c9n@googlegroups.com> <20211117122258.781af131@t530> <23d9c0b4-3da8-4340-b620-d4d0abafd98fn@googlegroups.com> <87lf1mv8fz.fsf@nightsong.com> <sn48kg$1b6j$1@gioia.aioe.org> <87r1bdta07.fsf@nightsong.com> <sn6thi$1c7m$1@gioia.aioe.org>
NNTP-Posting-Host: hera.math.uni.wroc.pl
X-Trace: z-news.wcss.wroc.pl 1637431870 18639 156.17.86.1 (20 Nov 2021 18:11:10 GMT)
X-Complaints-To: abuse@news.pwr.wroc.pl
NNTP-Posting-Date: Sat, 20 Nov 2021 18:11:10 +0000 (UTC)
Cancel-Lock: sha1:X5TwKP2dlQCOR4LvHWDtejNsZlw=
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64))
X-Received-Bytes: 3368
 by: antis...@math.uni.wroc.pl - Sat, 20 Nov 2021 18:11 UTC

dxforth <dxforth@gmail.com> wrote:
> On 19/11/2021 08:43, Paul Rubin wrote:
> > dxforth <dxforth@gmail.com> writes:
> >> The bigger concern is the author's starting point:
> >>
> >> "It's like Forth but written in Python. But I don't actually know for
> >> sure since I never programmed in Forth, I only heard that it's some
> >> sort of stack-based programming language."
> >
> > You may be onto something there. Implementing Forth without first
> > actually understanding Forth is a classic antipattern.
> >
> >> He's going to encounter the same issues Moore did. Whether he has the
> >> same resolve and ability to solve them remains to be seen.
> >
> > Moore had certain constraints to deal with, and the solution he reached
> > was inventing Forth. Certainly someone using Python and modern
> > computers doesn't have the same constraints. So if they reach the same
> > solution, something is suspicious.
>
> Languages have the same goal - irreducible simplicity. In selecting a
> stack-based language the definition of 'simplicity' narrows. Suspicion
> is if they didn't reach the same conclusions.

Consider stack-based language, with two stacks and dictionary of
words. Sounds like Forth? Well, a small sample of statements is:

1, 2 +, sin() -> a;
sin(1 + 2) -> a;
cons,[], cons() -> a;
cons(cons,[]) -> a;

First line is kind of ugly Forth: it needs commas and calling 'sin'
needs parenthesis. Second line is how most users would write the
same thing as first line. Third line is again in "ugly Forth"
style, it creates list consisting of function 'cons' and assigns
it to variable 'a'. Fourth line is how most users would write
the same thing as third line.

Is there something wrong with this language? If you want Forth,
then probably it is very wrong. OTOH, fourth line shows that
it can do things which probably would be more complicated in
Forth. There are tradeofs, designing programming language
you want to make some things easy, do not care if some other
things get more complicated and sometimes want to forbid
another things. Change goals and different language will
emerge...

--
Waldek Hebisch

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor