Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

The solution to a problem changes the nature of the problem. -- Peer


devel / comp.lang.forth / This is why ALLOCATE + SIZE is superior

SubjectAuthor
* This is why ALLOCATE + SIZE is superiornone
+* Re: This is why ALLOCATE + SIZE is superiorminforth
|+* Re: This is why ALLOCATE + SIZE is superiornone
||`* Re: This is why ALLOCATE + SIZE is superiorminforth
|| `* Re: This is why ALLOCATE + SIZE is superiornone
||  `- Re: This is why ALLOCATE + SIZE is superiorminforth
|`* Re: This is why ALLOCATE + SIZE is superiorAnton Ertl
| +* Re: This is why ALLOCATE + SIZE is superiorminforth
| |`- Re: This is why ALLOCATE + SIZE is superiorAnton Ertl
| `* Re: This is why ALLOCATE + SIZE is superiornone
|  `- Re: This is why ALLOCATE + SIZE is superiorAnton Ertl
`- Re: This is why ALLOCATE + SIZE is superiorHans Bezemer

1
This is why ALLOCATE + SIZE is superior

<nnd$7426dad8$58ba1876@ef92aa6f1a70d768>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: This is why ALLOCATE + SIZE is superior
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768>
Organization: KPN B.V.
Date: Mon, 04 Sep 2023 14:14:43 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 26
Injection-Date: Mon, 04 Sep 2023 14:14:43 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1561
 by: none - Mon, 4 Sep 2023 12:14 UTC

If you implement ALLOCATE yourself it is easy to incorporate SIZE :

1000 ALLOCATE THROW SIZE .
1000 OK

I have done that in my ALLOCATE and reportedly Hugh has done that
also. Maybe he even came up with that name.

You can now define :

\ To an allocated vector append an vector . Return new vector .
: vector-concat OVER SIZE DUP >R OVER SIZE + >R
SWAP R> RESIZE THROW ( first vector is now enlarged ) ( l e )
2DUP R> + OVER SIZE CMOVE NIP ;

This is applicable to vectors of cells or characters alike.
If you ALLOCATE your strings you can define
'vector-concat ALIAS $+

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: This is why ALLOCATE + SIZE is superior

<e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:393:b0:410:9b45:d7f6 with SMTP id j19-20020a05622a039300b004109b45d7f6mr288314qtx.10.1693903431403;
Tue, 05 Sep 2023 01:43:51 -0700 (PDT)
X-Received: by 2002:a17:902:d48c:b0:1b7:d4d2:c385 with SMTP id
c12-20020a170902d48c00b001b7d4d2c385mr4636198plg.1.1693903430931; Tue, 05 Sep
2023 01:43:50 -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: Tue, 5 Sep 2023 01:43:50 -0700 (PDT)
In-Reply-To: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f00:ebdf:25a9:ff9:c401:cf06;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f00:ebdf:25a9:ff9:c401:cf06
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>
Subject: Re: This is why ALLOCATE + SIZE is superior
From: minforth@arcor.de (minforth)
Injection-Date: Tue, 05 Sep 2023 08:43:51 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2347
 by: minforth - Tue, 5 Sep 2023 08:43 UTC

none albert schrieb am Montag, 4. September 2023 um 14:14:48 UTC+2:
> If you implement ALLOCATE yourself it is easy to incorporate SIZE :
>
> 1000 ALLOCATE THROW SIZE .
> 1000 OK
>
> I have done that in my ALLOCATE and reportedly Hugh has done that
> also. Maybe he even came up with that name.
>
> You can now define :
>
> \ To an allocated vector append an vector . Return new vector .
> : vector-concat OVER SIZE DUP >R OVER SIZE + >R
> SWAP R> RESIZE THROW ( first vector is now enlarged ) ( l e )
> 2DUP R> + OVER SIZE CMOVE NIP ;
>
> This is applicable to vectors of cells or characters alike.
> If you ALLOCATE your strings you can define
> 'vector-concat ALIAS $+

What is so special here? There are zillion ways to manage heap objects
incl. resizing.

One could use a big os-preallocated heap and do allocation/resizing of
Forth objects within that heap without recalling further os functions. But I
remember reading an essay saying that modern os allocation functions belong
to the most heavily optimized functions anyhow. Which means that it
can be hard to beat their performance.

Of course in bare metal embedded devices things look different.

Re: This is why ALLOCATE + SIZE is superior

<nnd$18d7908b$0cba14cd@b868e418de3f7c5d>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: This is why ALLOCATE + SIZE is superior
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$18d7908b$0cba14cd@b868e418de3f7c5d>
Organization: KPN B.V.
Date: Tue, 05 Sep 2023 12:07:34 +0200
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 44
Injection-Date: Tue, 05 Sep 2023 12:07:34 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2543
 by: none - Tue, 5 Sep 2023 10:07 UTC

In article <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>,
minforth <minforth@arcor.de> wrote:
>none albert schrieb am Montag, 4. September 2023 um 14:14:48 UTC+2:
>> If you implement ALLOCATE yourself it is easy to incorporate SIZE :
>>
>> 1000 ALLOCATE THROW SIZE .
>> 1000 OK
>>
>> I have done that in my ALLOCATE and reportedly Hugh has done that
>> also. Maybe he even came up with that name.
>>
>> You can now define :
>>
>> \ To an allocated vector append an vector . Return new vector .
>> : vector-concat OVER SIZE DUP >R OVER SIZE + >R
>> SWAP R> RESIZE THROW ( first vector is now enlarged ) ( l e )
>> 2DUP R> + OVER SIZE CMOVE NIP ;
>>
>> This is applicable to vectors of cells or characters alike.
>> If you ALLOCATE your strings you can define
>> 'vector-concat ALIAS $+
>
>What is so special here? There are zillion ways to manage heap objects
>incl. resizing.
>
>One could use a big os-preallocated heap and do allocation/resizing of
>Forth objects within that heap without recalling further os functions. But I
>remember reading an essay saying that modern os allocation functions belong
>to the most heavily optimized functions anyhow. Which means that it
>can be hard to beat their performance.
>
>Of course in bare metal embedded devices things look different.

What are you talking about? Optimization is the last thing on my mind.
Ease of programming is. Traditional malloc don't allow you to
retrive size.

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: This is why ALLOCATE + SIZE is superior

<96c68e49-4de7-4538-885f-838692d3d5fdn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:18ef:b0:649:9713:741 with SMTP id ep15-20020a05621418ef00b0064997130741mr271422qvb.12.1693913359767;
Tue, 05 Sep 2023 04:29:19 -0700 (PDT)
X-Received: by 2002:a05:6a00:1883:b0:68a:46d4:b863 with SMTP id
x3-20020a056a00188300b0068a46d4b863mr5823957pfh.4.1693913359231; Tue, 05 Sep
2023 04:29:19 -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: Tue, 5 Sep 2023 04:29:18 -0700 (PDT)
In-Reply-To: <nnd$18d7908b$0cba14cd@b868e418de3f7c5d>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f00:eb6f:801c:847:edb8:def9;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f00:eb6f:801c:847:edb8:def9
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>
<nnd$18d7908b$0cba14cd@b868e418de3f7c5d>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <96c68e49-4de7-4538-885f-838692d3d5fdn@googlegroups.com>
Subject: Re: This is why ALLOCATE + SIZE is superior
From: minforth@arcor.de (minforth)
Injection-Date: Tue, 05 Sep 2023 11:29:19 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3134
 by: minforth - Tue, 5 Sep 2023 11:29 UTC

none albert schrieb am Dienstag, 5. September 2023 um 12:07:37 UTC+2:
> In article <e29c5b36-128e-43c6...@googlegroups.com>,
> minforth <minf...@arcor.de> wrote:
> >none albert schrieb am Montag, 4. September 2023 um 14:14:48 UTC+2:
> >> If you implement ALLOCATE yourself it is easy to incorporate SIZE :
> >>
> >> 1000 ALLOCATE THROW SIZE .
> >> 1000 OK
> >>
> >> I have done that in my ALLOCATE and reportedly Hugh has done that
> >> also. Maybe he even came up with that name.
> >>
> >> You can now define :
> >>
> >> \ To an allocated vector append an vector . Return new vector .
> >> : vector-concat OVER SIZE DUP >R OVER SIZE + >R
> >> SWAP R> RESIZE THROW ( first vector is now enlarged ) ( l e )
> >> 2DUP R> + OVER SIZE CMOVE NIP ;
> >>
> >> This is applicable to vectors of cells or characters alike.
> >> If you ALLOCATE your strings you can define
> >> 'vector-concat ALIAS $+
> >
> >What is so special here? There are zillion ways to manage heap objects
> >incl. resizing.
> >
> >One could use a big os-preallocated heap and do allocation/resizing of
> >Forth objects within that heap without recalling further os functions. But I
> >remember reading an essay saying that modern os allocation functions belong
> >to the most heavily optimized functions anyhow. Which means that it
> >can be hard to beat their performance.
> >
> >Of course in bare metal embedded devices things look different.
> What are you talking about? Optimization is the last thing on my mind.
> Ease of programming is. Traditional malloc don't allow you to
> retrive size.

Okay. malloc/resize have the desired size as input argument, so it is already known.
When they fail, they return an error indicator.
When they succeed, the actually allocated size can be larger (eg by memory page granularity).
Did I overlook something?

Re: This is why ALLOCATE + SIZE is superior

<nnd$0b222a0b$050a6b07@dc1ba8a0c5690b40>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: This is why ALLOCATE + SIZE is superior
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com> <nnd$18d7908b$0cba14cd@b868e418de3f7c5d> <96c68e49-4de7-4538-885f-838692d3d5fdn@googlegroups.com>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$0b222a0b$050a6b07@dc1ba8a0c5690b40>
Organization: KPN B.V.
Date: Wed, 06 Sep 2023 11:22:31 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 56
Injection-Date: Wed, 06 Sep 2023 11:22:31 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3297
 by: none - Wed, 6 Sep 2023 09:22 UTC

In article <96c68e49-4de7-4538-885f-838692d3d5fdn@googlegroups.com>,
minforth <minforth@arcor.de> wrote:
>none albert schrieb am Dienstag, 5. September 2023 um 12:07:37 UTC+2:
>> In article <e29c5b36-128e-43c6...@googlegroups.com>,
>> minforth <minf...@arcor.de> wrote:
>> >none albert schrieb am Montag, 4. September 2023 um 14:14:48 UTC+2:
>> >> If you implement ALLOCATE yourself it is easy to incorporate SIZE :
>> >>
>> >> 1000 ALLOCATE THROW SIZE .
>> >> 1000 OK
>> >>
>> >> I have done that in my ALLOCATE and reportedly Hugh has done that
>> >> also. Maybe he even came up with that name.
>> >>
>> >> You can now define :
>> >>
>> >> \ To an allocated vector append an vector . Return new vector .
>> >> : vector-concat OVER SIZE DUP >R OVER SIZE + >R
>> >> SWAP R> RESIZE THROW ( first vector is now enlarged ) ( l e )
>> >> 2DUP R> + OVER SIZE CMOVE NIP ;
>> >>
>> >> This is applicable to vectors of cells or characters alike.
>> >> If you ALLOCATE your strings you can define
>> >> 'vector-concat ALIAS $+
>> >
>> >What is so special here? There are zillion ways to manage heap objects
>> >incl. resizing.
>> >
>> >One could use a big os-preallocated heap and do allocation/resizing of
>> >Forth objects within that heap without recalling further os functions. But I
>> >remember reading an essay saying that modern os allocation functions belong
>> >to the most heavily optimized functions anyhow. Which means that it
>> >can be hard to beat their performance.
>> >
>> >Of course in bare metal embedded devices things look different.
>> What are you talking about? Optimization is the last thing on my mind.
>> Ease of programming is. Traditional malloc don't allow you to
>> retrive size.
>
>Okay. malloc/resize have the desired size as input argument, so it is
>already known.
>When they fail, they return an error indicator.
>When they succeed, the actually allocated size can be larger (eg by memory
>page granularity).
>Did I overlook something?
>
A really substantial hassle. You need to keep track of the sizes.
E.g. concatenate gets 4 stack items instead of two.

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: This is why ALLOCATE + SIZE is superior

<cd48847d-030b-4fcc-8868-be0ec66d3724n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1a9e:b0:412:16d9:f0f1 with SMTP id s30-20020a05622a1a9e00b0041216d9f0f1mr334489qtc.6.1694027245496;
Wed, 06 Sep 2023 12:07:25 -0700 (PDT)
X-Received: by 2002:a63:3745:0:b0:56a:f46:756c with SMTP id
g5-20020a633745000000b0056a0f46756cmr3462026pgn.0.1694027245036; Wed, 06 Sep
2023 12:07:25 -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: Wed, 6 Sep 2023 12:07:24 -0700 (PDT)
In-Reply-To: <nnd$0b222a0b$050a6b07@dc1ba8a0c5690b40>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f00:eb31:1c56:f194:85e8:e55;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f00:eb31:1c56:f194:85e8:e55
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>
<nnd$18d7908b$0cba14cd@b868e418de3f7c5d> <96c68e49-4de7-4538-885f-838692d3d5fdn@googlegroups.com>
<nnd$0b222a0b$050a6b07@dc1ba8a0c5690b40>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cd48847d-030b-4fcc-8868-be0ec66d3724n@googlegroups.com>
Subject: Re: This is why ALLOCATE + SIZE is superior
From: minforth@arcor.de (minforth)
Injection-Date: Wed, 06 Sep 2023 19:07:25 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1698
 by: minforth - Wed, 6 Sep 2023 19:07 UTC

none albert schrieb am Mittwoch, 6. September 2023 um 11:22:34 UTC+2:
> In article <96c68e49-4de7-4538...@googlegroups.com>,
> minforth <minf...@arcor.de> wrote:
> >Did I overlook something?
> >
> A really substantial hassle. You need to keep track of the sizes.
> E.g. concatenate gets 4 stack items instead of two.

I see, stack juggling is evil

Re: This is why ALLOCATE + SIZE is superior

<029ac310-24c5-402c-8d45-4443bd345c82n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4689:b0:76f:d16:59eb with SMTP id bq9-20020a05620a468900b0076f0d1659ebmr470587qkb.11.1694039015678;
Wed, 06 Sep 2023 15:23:35 -0700 (PDT)
X-Received: by 2002:a05:620a:40f:b0:76e:1a6a:165 with SMTP id
15-20020a05620a040f00b0076e1a6a0165mr378696qkp.14.1694039015473; Wed, 06 Sep
2023 15:23:35 -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: Wed, 6 Sep 2023 15:23:35 -0700 (PDT)
In-Reply-To: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <029ac310-24c5-402c-8d45-4443bd345c82n@googlegroups.com>
Subject: Re: This is why ALLOCATE + SIZE is superior
From: the.beez.speaks@gmail.com (Hans Bezemer)
Injection-Date: Wed, 06 Sep 2023 22:23:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2508
 by: Hans Bezemer - Wed, 6 Sep 2023 22:23 UTC

On Monday, September 4, 2023 at 2:14:48 PM UTC+2, none albert wrote:
> If you implement ALLOCATE yourself it is easy to incorporate SIZE :
>
> 1000 ALLOCATE THROW SIZE .
> 1000 OK
>
> I have done that in my ALLOCATE and reportedly Hugh has done that
> also. Maybe he even came up with that name.
>
> You can now define :
>
> \ To an allocated vector append an vector . Return new vector .
> : vector-concat OVER SIZE DUP >R OVER SIZE + >R
> SWAP R> RESIZE THROW ( first vector is now enlarged ) ( l e )
> 2DUP R> + OVER SIZE CMOVE NIP ;
>
> This is applicable to vectors of cells or characters alike.
> If you ALLOCATE your strings you can define
> 'vector-concat ALIAS $+
>
> 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 -
4tH has got it too, but it is called ALLOCATED. Like ERROR I felt SIZE was
too likely to be used in an application program. And since it isn't standardized
I kept it out of harms way. 4tH doesn't allow implicit redefinition.

Hans Bezemer

Re: This is why ALLOCATE + SIZE is superior

<2023Sep7.092145@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: This is why ALLOCATE + SIZE is superior
Date: Thu, 07 Sep 2023 07:21:45 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 28
Message-ID: <2023Sep7.092145@mips.complang.tuwien.ac.at>
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>
Injection-Info: dont-email.me; posting-host="9211c976b38d37528a71ee41653d87e0";
logging-data="3067771"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+4Ms3DGbFO8iUNNSHMXrL"
Cancel-Lock: sha1:E4jKYdFI330zWW7SeenCicRiDUg=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 7 Sep 2023 07:21 UTC

minforth <minforth@arcor.de> writes:
>But I
>remember reading an essay saying that modern os allocation functions belong
>to the most heavily optimized functions anyhow. Which means that it
>can be hard to beat their performance.

I have read that many times over the decades. And then I did the
measurements for Figure 14 of
<http://euroforth.org/ef17/papers/ertl.pdf>, and found those funny
kinky lines; I believe they come from the ALLOCATE and FREE calls
(which used glibc's malloc() and free() implementations). So in
further work <http://euroforth.org/ef18/papers/ertl-chaining.pdf> I
implemented a cache of freed vectors. Some time later a new version
of glibc appeared, and the announcement claimed to reduce the overhead
of thread synchronization (which apparently also slows down
single-threaded programs like my benchmarks) of earlier versions by
using a per-thread cache of freed memory areas.

So maybe the allocation functions have been heavily optimized at least
since Doug Lea published his allocator. This does not mean that we
are close to the optimum.

- 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: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: This is why ALLOCATE + SIZE is superior

<5c72f16b-6bc9-4dd5-99cb-8bf498527b7bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1745:b0:401:e2bb:e429 with SMTP id l5-20020a05622a174500b00401e2bbe429mr393575qtk.9.1694073652576;
Thu, 07 Sep 2023 01:00:52 -0700 (PDT)
X-Received: by 2002:a63:ee0f:0:b0:56c:2f67:7294 with SMTP id
e15-20020a63ee0f000000b0056c2f677294mr3758731pgi.5.1694073652246; Thu, 07 Sep
2023 01:00:52 -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: Thu, 7 Sep 2023 01:00:51 -0700 (PDT)
In-Reply-To: <2023Sep7.092145@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=87.157.109.105; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 87.157.109.105
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com>
<2023Sep7.092145@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5c72f16b-6bc9-4dd5-99cb-8bf498527b7bn@googlegroups.com>
Subject: Re: This is why ALLOCATE + SIZE is superior
From: minforth@arcor.de (minforth)
Injection-Date: Thu, 07 Sep 2023 08:00:52 +0000
Content-Type: text/plain; charset="UTF-8"
 by: minforth - Thu, 7 Sep 2023 08:00 UTC

Anton Ertl schrieb am Donnerstag, 7. September 2023 um 09:40:13 UTC+2:
> minforth <minf...@arcor.de> writes:
> >But I
> >remember reading an essay saying that modern os allocation functions belong
> >to the most heavily optimized functions anyhow. Which means that it
> >can be hard to beat their performance.
> I have read that many times over the decades. And then I did the
> measurements for Figure 14 of
> <http://euroforth.org/ef17/papers/ertl.pdf>, and found those funny
> kinky lines; I believe they come from the ALLOCATE and FREE calls
> (which used glibc's malloc() and free() implementations). So in
> further work <http://euroforth.org/ef18/papers/ertl-chaining.pdf> I
> implemented a cache of freed vectors. Some time later a new version
> of glibc appeared, and the announcement claimed to reduce the overhead
> of thread synchronization (which apparently also slows down
> single-threaded programs like my benchmarks) of earlier versions by
> using a per-thread cache of freed memory areas.
>
> So maybe the allocation functions have been heavily optimized at least
> since Doug Lea published his allocator. This does not mean that we
> are close to the optimum.

Obviously. I am guessing that Linux is still mostly a server OS and thus
optimizations are more targeted towards running huge amounts of parallel jobs
on multi-CPU machines (eg K8s clusters). Not really Forth's domain.

But this is not my field of expertise. For example I really can't estimate whether
your benchmark would show different results between a Linux enterprise or
desktop variant of the same distribution, or if they all use the same kernel module.

Re: This is why ALLOCATE + SIZE is superior

<nnd$006d8303$614e6faf@59e4cfc0a767ce26>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: This is why ALLOCATE + SIZE is superior
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com> <2023Sep7.092145@mips.complang.tuwien.ac.at>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$006d8303$614e6faf@59e4cfc0a767ce26>
Organization: KPN B.V.
Date: Thu, 07 Sep 2023 11:39:39 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news-2.dfn.de!news.dfn.de!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 41
Injection-Date: Thu, 07 Sep 2023 11:39:39 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2695
 by: none - Thu, 7 Sep 2023 09:39 UTC

In article <2023Sep7.092145@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>minforth <minforth@arcor.de> writes:
>>But I
>>remember reading an essay saying that modern os allocation functions belong
>>to the most heavily optimized functions anyhow. Which means that it
>>can be hard to beat their performance.
>
>I have read that many times over the decades. And then I did the
>measurements for Figure 14 of
><http://euroforth.org/ef17/papers/ertl.pdf>, and found those funny
>kinky lines; I believe they come from the ALLOCATE and FREE calls
>(which used glibc's malloc() and free() implementations). So in
>further work <http://euroforth.org/ef18/papers/ertl-chaining.pdf> I
>implemented a cache of freed vectors. Some time later a new version
>of glibc appeared, and the announcement claimed to reduce the overhead
>of thread synchronization (which apparently also slows down
>single-threaded programs like my benchmarks) of earlier versions by
>using a per-thread cache of freed memory areas.
>
>So maybe the allocation functions have been heavily optimized at least
>since Doug Lea published his allocator. This does not mean that we
>are close to the optimum.

Then there is the notion that allocate/free is one-size fits-all
approach. There are always circumstances that a strategy that will
benefit some applications and will harm others.

That opens an opportunity for Forth to adapt a simple ALLOCATE/FREE
for the situation at hand. It is not so simple to customize glib's
allocate/free.

>
>- anton
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: This is why ALLOCATE + SIZE is superior

<2023Sep8.095833@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: This is why ALLOCATE + SIZE is superior
Date: Fri, 08 Sep 2023 07:58:33 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 37
Message-ID: <2023Sep8.095833@mips.complang.tuwien.ac.at>
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com> <2023Sep7.092145@mips.complang.tuwien.ac.at> <5c72f16b-6bc9-4dd5-99cb-8bf498527b7bn@googlegroups.com>
Injection-Info: dont-email.me; posting-host="94d1b61d4d24ca29fa3ec14b726a2fea";
logging-data="3567526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/PXFIz0onMRJps0Nm6bdEU"
Cancel-Lock: sha1:PFvzYa82nN4SXRm+KcJMWu2hj7M=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 8 Sep 2023 07:58 UTC

minforth <minforth@arcor.de> writes:
>Anton Ertl schrieb am Donnerstag, 7. September 2023 um 09:40:13 UTC+2:
>> So maybe the allocation functions have been heavily optimized at least
>> since Doug Lea published his allocator. This does not mean that we
>> are close to the optimum.
>
>Obviously. I am guessing that Linux is still mostly a server OS and thus
>optimizations are more targeted towards running huge amounts of parallel jobs
>on multi-CPU machines (eg K8s clusters).

If that was true, what would be its relevance for the topic at hand?

>Not really Forth's domain.

Really? Forth did multi-user support before Linux even existed.
Forth did clusters (e.g., in Riad airport, but also in the particle
accelerator in Munich) also before Linux existed.

>But this is not my field of expertise. For example I really can't estimate whether
>your benchmark would show different results between a Linux enterprise or
>desktop variant of the same distribution, or if they all use the same kernel module.

Kernel modules don't come into play (at least if the problem was
really malloc()/free()). malloc() and free() are not implemented by
the kernel, but by libc. I used glibc, the same libc implementation
that most distributions, including server distributions use.

The typical difference between the server and desktop version of a
distribution is that the desktop version provides more software, but
the software provided in the server version is supported longer.

- 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: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: This is why ALLOCATE + SIZE is superior

<2023Sep8.103631@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: This is why ALLOCATE + SIZE is superior
Date: Fri, 08 Sep 2023 08:36:31 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 19
Message-ID: <2023Sep8.103631@mips.complang.tuwien.ac.at>
References: <nnd$7426dad8$58ba1876@ef92aa6f1a70d768> <e29c5b36-128e-43c6-94f7-5ca5a0f078aen@googlegroups.com> <2023Sep7.092145@mips.complang.tuwien.ac.at> <nnd$006d8303$614e6faf@59e4cfc0a767ce26>
Injection-Info: dont-email.me; posting-host="94d1b61d4d24ca29fa3ec14b726a2fea";
logging-data="3573902"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5LF1Z6c2jXbglvMX7+pCV"
Cancel-Lock: sha1:H9isE+X1idu9ZoPNkr+WsMiwcgI=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 8 Sep 2023 08:36 UTC

albert@cherry.(none) (albert) writes:
>That opens an opportunity for Forth to adapt a simple ALLOCATE/FREE
>for the situation at hand. It is not so simple to customize glib's
>allocate/free.

I have often read about custom allocators used in C programs, and less
often in Forth programs (probably because Forth fans still often try
to do it all with static allocation).

The goal of optimizations of malloc() and free() is to make such extra
effort unnecessary, but at least the version (in glibc-2.24 or so) that
I used in 2017 obviously had not achieved this goal.

- 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: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor