Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

17 May, 2024: There seems to be a temporary issue with the receiving email server (beagle.ediacara.org) for some moderated groups.
This means moderators are not receiving articles to moderate.
Hopefully they will fix their issue soon and moderated groups will function properly.


devel / comp.lang.python / Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

SubjectAuthor
* ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
|`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Julio Di Egidio
|`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
| `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Julio Di Egidio
+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
|`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
| `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
 `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Terry Reedy
  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | +- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Julio Di Egidio
   | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
   | | |+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | ||+- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
   | | ||`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
   | | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)alister
   | | | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Julio Di Egidio
   | | |   `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Julio Di Egidio
   | | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)alister
   | | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)alister
   | | |   +- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)alister
   | | |   `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |    +- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |    +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |    |+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)alister
   | | |    ||`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |    || +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |    || |`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | |    || `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)DFS
   | | |    |`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
   | | |    `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)alister
   | | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)DFS
   | | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | | `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
   | |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   | |   `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
   | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   |  +- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   |  `* RE: ANN: Dogelog Runtime, Prolog to the Moon (2021)Avi Gross
   |   `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
   `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
    `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
     | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     | | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  +- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     | |  |+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  ||+- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  ||+- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  ||`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     | |  |+* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
     | |  ||`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  || `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  |+- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  |`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Peter J. Holzer
     | |  |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | |+- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | |`* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing
     | |  | | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | |   `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | +* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Michael F. Stemper
     | |  | |`- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Peter J. Holzer
     | |  |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  |   `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     | |   `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |    `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |     `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | |      `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mark Lawrence
     | |       `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     | `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     |  `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Chris Angelico
     |   `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     |    `* Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     |     `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Mostowski Collapse
     `- Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)Greg Ewing

Pages:1234
Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<mailman.736.1631842184.4164.python-list@python.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Fri, 17 Sep 2021 11:29:29 +1000
Lines: 18
Message-ID: <mailman.736.1631842184.4164.python-list@python.org>
References: <sfb25a$3a5$1@solani.org> <shq65d$vro$1@solani.org>
<shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<CAPTjJmobSHAbubpmFmMtCuozCAQZ95ovVoj7qQLkDcXGRR3VJw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 6F05EoYlgVhMYCpioq5NcgfevEI/WI/1/sjYVaLRpuWQ==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=kNQ5n59W;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.061
X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; '17,': 0.04; '7:17': 0.16;
'another,': 0.16; 'chrisa': 0.16; 'collection,': 0.16;
'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iso':
0.16; 'okay,': 0.16; 'subject:ANN': 0.16; 'thats': 0.16; 'wrote:':
0.16; 'implement': 0.19; 'to:addr:python-list': 0.20; 'language':
0.21; 'fri,': 0.22; 'code': 0.23; 'cannot': 0.25; 'do,': 0.26;
'error': 0.29; 'wondering': 0.31; 'lists,': 0.32; 'sep': 0.32;
'to:name:python': 0.32; 'message-id:@mail.gmail.com': 0.32;
'core': 0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com':
0.34; 'received:209.85.166': 0.35; 'from:addr:gmail.com': 0.35;
'change': 0.36; "it's": 0.37; 'received:209.85': 0.37;
'received:209': 0.39; 'single': 0.39; 'try': 0.40; 'your': 0.64;
'top': 0.65; '2021': 0.71; 'performance': 0.71; "you'll": 0.73;
'subject:2021': 0.76; 'garbage': 0.84; 'improvement.': 0.84;
'massive': 0.84; 'collapse': 0.91; 'shrink': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=hmXRpdbHIr1jh1w3kus8cmRSP3c1Th+zNpeqcH6RUgE=;
b=kNQ5n59WDGjwHihBqxTf5xLApPU+DzWV4oAhqBv2vI8sQ1PEKToVhBdO4coH6Eq57Q
Oa/+ikxhnK1o+dvQXg06LD+3+ndVfaQcsPKoKE6F+7XrX/zLEgkX25kzuKoeBGzslF2i
P8zVkKl2+AYqORmzgirRQzV0iTLzWQ05ILicAT6w+5+yJp4Y5o+hdEoVY4s9qcKndw2b
wmZg+wjyDZe0cmh6m5wu0+y9FDYaH6jB0do94ZwohG2TIgPU0xn4W61n56vdtxIBK84N
R3nX8sRWFDD0i2Y5es18KxEbIaOl5riqiYR6vTU19wuEVS6Fgr8/vYBYURNSaY5uckoh
F5yw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=hmXRpdbHIr1jh1w3kus8cmRSP3c1Th+zNpeqcH6RUgE=;
b=xMwQAG1zGsRyCGRLfVjAt2WNs30o+0JNUbiE282s2NmM1C29qFP3K8f5IQaKBRfbu4
NJ5lCdZYndwMCmhYbsKn9sf9RacVK4Q5fdWTmcrNtBikRs0/tCnlbc5GaX+L31hrXN6E
IHdKb+YsrrgKkSVMOwJsijv1NpPdjRute8/LdCwMlEn4fjw6W0btGJVCGAnVlfr87DBu
80vmCDaF2j52vARKxpWJeyAYVq/7xa5lxim46rKPAix5QNv40DysmDkh8qolgA/Wzsza
xRcJP4RkAOHZXCtMsIg1RH2RZcxzRE1xltD3MINLsdd57JdZAnD/EIELrVNWUD3s0puM
zpxQ==
X-Gm-Message-State: AOAM530XNs5nClEKwm6dkuGhk+z6eEWfbdyuG3PWqD3DBHQUNXoD5tvx
8Xmt0yKs32AbQmLQTLHBCYPLlZOMpiFKg7e4LuNOpPBjMS8=
X-Google-Smtp-Source: ABdhPJzMpsJQU7B0g/Gw++XARMesZ+wWofyPKUTugudfDwTImmb3yPsF10c1mL76ZjYu5xbH6dZsySAMbRncttCosG4=
X-Received: by 2002:a92:c64a:: with SMTP id 10mr6008243ill.102.1631842180701;
Thu, 16 Sep 2021 18:29:40 -0700 (PDT)
In-Reply-To: <si07i1$ds$1@solani.org>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmobSHAbubpmFmMtCuozCAQZ95ovVoj7qQLkDcXGRR3VJw@mail.gmail.com>
X-Mailman-Original-References: <sfb25a$3a5$1@solani.org>
<shq65d$vro$1@solani.org>
<shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
 by: Chris Angelico - Fri, 17 Sep 2021 01:29 UTC

On Fri, Sep 17, 2021 at 7:17 AM Mostowski Collapse <janburse@fastmail.fm> wrote:
>
> About Exceptions: Thats just building ISO core
> standard Prolog error terms.
>
> About Garbage Collection: Thats just Prolog
> garbage collection, which does shrink some
> single linked lists, which ordinary
> programmig language GC cannot do,
>

Okay, so.... you're building your own garbage collection on top of
Python's, and you're wondering why it's slow?

Change your code to not try to implement one language inside another,
and you'll see a massive performance improvement.

ChrisA

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<iqi9lbFe3t2U1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Fri, 17 Sep 2021 13:34:35 +1200
Lines: 24
Message-ID: <iqi9lbFe3t2U1@mid.individual.net>
References: <sfb25a$3a5$1@solani.org> <shnh7g$hms$2@solani.org>
<shoeic$sq0$1@ciao.gmane.io>
<mailman.720.1631568443.4164.python-list@python.org>
<shq65d$vro$1@solani.org> <shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net LehfXKyVdK3hftaYx+36egDsdUk8i6GzAiZiyjF7QS4jjn7T5A
Cancel-Lock: sha1:sfnID//cTvJPGL9X95z4EawfP+w=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
Content-Language: en-US
 by: Greg Ewing - Fri, 17 Sep 2021 01:34 UTC

On 16/09/21 2:56 pm, Mostowski Collapse wrote:
> I can access the functor of a compound via:
>
> obj.functor
>
> but when I flatten Compound into arrays, it would become:
>
> obj[0]
>
> Should I declare a constant FUNCTOR = 0?

You could, but keep in mind that access to a global in Python
is somewhat expensive, since it requires a dictionary lookup.

There's always a tradeoff between clarity and efficiency.
In this case, I think obj[0] is clear enough -- the reader
will be well aware that the first item of a term is the
functor. Especially if you use a name that makes it clear
what kind of object it is, rather than a generic name such
as "obj".

--
Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<iqia7iFe6utU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Fri, 17 Sep 2021 13:44:18 +1200
Lines: 45
Message-ID: <iqia7iFe6utU1@mid.individual.net>
References: <sfb25a$3a5$1@solani.org> <shnh7g$hms$2@solani.org>
<shoeic$sq0$1@ciao.gmane.io>
<mailman.720.1631568443.4164.python-list@python.org>
<shq65d$vro$1@solani.org> <shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net XX7dgA7EWc22Z7gdyrxruwN5u6MrU67RBME2LAgCu5Qqx5twxo
Cancel-Lock: sha1:H9EDPC7OaunpGbeudgJwsYdrJUs=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
Content-Language: en-US
 by: Greg Ewing - Fri, 17 Sep 2021 01:44 UTC

On 16/09/21 6:56 am, Mostowski Collapse wrote:
> What could be slow, repeatedly requesting the "args"
> field. Maybe I should do:
>
> help = term.args
> i = 0
> while i < len(help) - 1:
> ____mark_term(help[i])
> ____i += 1
> term = help[i]

Yes, that will certainly help.

But you're still evaluating len(help) - 1 every time around
the loop, so this is even better:

help = term.args
n = len(help) - 1
i = 0
while i < n:
mark_term(help[i])
i += 1
term = help[i]

Some general principles to be aware of:

* Almost nothing is free -- Python very literally does what
you tell it to do, even if it looks dumb.

* Access to attributes and global variables is expensive
(requires at least one dict lookup, often more in the case
of attributes).

* Access to *local* variables, on the other hand, is very
cheap (essentially an array lookup).

* Function calls are expensive -- both to look up the name, if
it's global, which it usually is, and the machinery of the
call itself.

* Creating objects is expensive. Creating instances of
user-defined objects is more expensive than built-in ones.

--
Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si1kbq$lt3$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Fri, 17 Sep 2021 10:41:27 +0200
Message-ID: <si1kbq$lt3$1@solani.org>
References: <sfb25a$3a5$1@solani.org> <shnh7g$hms$2@solani.org>
<shoeic$sq0$1@ciao.gmane.io>
<mailman.720.1631568443.4164.python-list@python.org>
<shq65d$vro$1@solani.org> <shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <iqi91hFe0llU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 17 Sep 2021 08:41:30 -0000 (UTC)
Injection-Info: solani.org;
logging-data="22435"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
Cancel-Lock: sha1:uT4SLoJ0nE1uoQffEhKQ5v4JFKs=
In-Reply-To: <iqi91hFe0llU1@mid.individual.net>
X-User-ID: eJwNx8EBwCAIA8CVREjAcZDC/iPY+x2UwnIjaBhMXKgYlf33o3c3YEuJScrWs7qacy0rwkLSvPTAK/ZySXk7+RSv
 by: Mostowski Collapse - Fri, 17 Sep 2021 08:41 UTC

Thanks for your response, will have a look.
Ok, dis() is all that is need to disassemble.

Very cool!

A long term goal could be indeed to have
a Prolog interpreter produce 20MLips, like
SWI-Prolog, but tightly integrated into

Python. So that it directly makes use of
the Python objects and the Python garbage
collection like Dogelog Runtime.

Although Dogelog Runtime has its own
garbage collection, its only used to help
the native Python garbage collection.

The result is that you can enjoy bi-directly
calling Python. For example the Prolog
adding of two numbers is realized as:

###
# +(A, B, C): [ISO 9.1.7]
# The predicate succeeds in C with the sum of A and B.
##
def eval_add(alpha, beta):
check_number(alpha)
check_number(beta)
try:
return alpha + beta
except OverflowError:
raise make_error(Compound("evaluation_error", ["float_overflow"]))

And then register it:

add("+", 3, make_dispatch(eval_add, MASK_MACH_FUNC))

Could also map the exception to a Prolog term later.
Thats not so much an issue for speed. The sunshine
case is straight forward.

But I might try dis() on eval_add(). Are exceptions
blocks in Python cheap or expensive? Are they like
in Java, some code annotation, or like in Go

programming language pushing some panic handler?

Greg Ewing schrieb:
> On 16/09/21 4:23 am, Mostowski Collapse wrote:
>> I really wonder why my Python implementation
>> is a factor 40 slower than my JavaScript implementation.
>
> There are Javascript implementations around nowadays that are
> blazingly fast. Partly that's because a lot of effort has been
> put into them, but it's also because Javascript is a different
> language. There are many dynamic aspects to Python that make
> fast implementations difficult.
>
>> I use in Python:
>>
>>    temp = [NotImplemented] * code[pos]
>>    pos += 1
>>
>> is the the idiom [_] * _ slow?
>
> No, on the contrary it's probably the fastest way to do it
> in Python. You could improve it a bit by precomputing
> [NotImplemented]:
>
> # once at the module level
> NotImplementedList = [NotImplemented]
>
> # whenever you want a new list
> temp = NotImplementedList * code[pos]
>
> That's probably at least as fast as built-in function for
> creating lists would be.
>
>> does it really first create an
>> array of size 1 and then enlarge it?
>
> It does:
>
> >>> def f(code, pos):
> ...  return [NotImplemented] * code[pos]
> ...
> >>> from dis import dis
> >>> dis(f)
>   2           0 LOAD_GLOBAL              0 (NotImplemented)
>               2 BUILD_LIST               1
>               4 LOAD_FAST                0 (code)
>               6 LOAD_FAST                1 (pos)
>               8 BINARY_SUBSCR
>              10 BINARY_MULTIPLY
>              12 RETURN_VALUE
>
> BTW, the Python terminology is "list", not "array".
> (There *is* something in the stdlib called an array, but
> it's rarely used or needed.)
>

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si1kuj$m9l$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Fri, 17 Sep 2021 10:51:29 +0200
Message-ID: <si1kuj$m9l$1@solani.org>
References: <sfb25a$3a5$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<CAPTjJmobSHAbubpmFmMtCuozCAQZ95ovVoj7qQLkDcXGRR3VJw@mail.gmail.com>
<mailman.736.1631842184.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 17 Sep 2021 08:51:31 -0000 (UTC)
Injection-Info: solani.org;
logging-data="22837"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
In-Reply-To: <mailman.736.1631842184.4164.python-list@python.org>
Cancel-Lock: sha1:lodXoT3jC3bEwCyebvw2IRClnN0=
X-User-ID: eJwFwQkBACAIA8BK8g2Mo8j6R/AuDIJOR8CDQVekhzUGy/bILHmiRoQ+j2Ruqp9k1ZQbKhtKLQ7Q98r5I28Uvw==
 by: Mostowski Collapse - Fri, 17 Sep 2021 08:51 UTC

No its cooperative. Usually objects do get
garbage collected by the native garbage collector
of the host language in Dogelog runtime.

The Prolog garbage collection is only to help
the host language garbage collector when you have
a deep recursion in Prolog.

You can then reclaim intermediate variables.
A simple example to test the slightly idio-
syncratic Prolog garbage collection is:

fibo(0, 1) :- !.
fibo(1, 1) :- !.
fibo(N, X) :-
M is N-1, fibo(M, Y),
L is M-1, fibo(L, Z),
X is Y+Z.

When running fibo(30,X) SWI-Prolog does around
800 garbage collections to keep the environment
small. But SWI-Prolog allocates all its objects

only very seldom on the heap. It uses its own
stack. On the other hand Dogelog runtime creates
everything on the heap. And completely relies on

the host language garbage collection. It only
helps the host language garbage collection it
that it performs from time to time this movement:

Before:

-->[ A ]-->[ B ]-->[ C ]-->

After:

-->[ A ]---------->[ C ]-->

A,B,C are objects of type Variable. The above
movement only happens for objects of type Variables
from time to time. For objects of type Compound

no modifications are done during Prolog garbage
collection. The Prolog garbage collection aggressively
nulls the Variable object B, and the host language

later will garbage collect what the Variable object B
was pointing to. But the Variable object B might
nevertheless have point to something shared with

some other Variable object or a local or a global
Python variable, or a Compound. This is then all
courtesy of the host language to decide reachability.

Chris Angelico schrieb:
> On Fri, Sep 17, 2021 at 7:17 AM Mostowski Collapse <janburse@fastmail.fm> wrote:
>>
>> About Exceptions: Thats just building ISO core
>> standard Prolog error terms.
>>
>> About Garbage Collection: Thats just Prolog
>> garbage collection, which does shrink some
>> single linked lists, which ordinary
>> programmig language GC cannot do,
>>
>
> Okay, so.... you're building your own garbage collection on top of
> Python's, and you're wondering why it's slow?
>
> Change your code to not try to implement one language inside another,
> and you'll see a massive performance improvement.
>
> ChrisA
>

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si1lc0$mhq$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!paganini.bofh.team!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Fri, 17 Sep 2021 10:58:38 +0200
Message-ID: <si1lc0$mhq$1@solani.org>
References: <sfb25a$3a5$1@solani.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<CAPTjJmobSHAbubpmFmMtCuozCAQZ95ovVoj7qQLkDcXGRR3VJw@mail.gmail.com>
<mailman.736.1631842184.4164.python-list@python.org>
<si1kuj$m9l$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 17 Sep 2021 08:58:40 -0000 (UTC)
Injection-Info: solani.org;
logging-data="23098"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
X-User-ID: eJwNzMkRACEIBMCUGDlGwmFR8g9hrep3uwaiaeFhPj4jLYltfJBNLXgfPUxd3D29TIu4I5+PIHDmVmvlS5K3fjlgFWw=
In-Reply-To: <si1kuj$m9l$1@solani.org>
Cancel-Lock: sha1:yjtprRk9PcGX2FH9R33j+zPqNIM=
 by: Mostowski Collapse - Fri, 17 Sep 2021 08:58 UTC

The Prolog garbage collection that does
the movement on the variable trail is only
a very small fraction of the runtime.

The garbage collection time is measured.
Some measurements with version 0.9.5
took the following values:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Standard Python Version, Warm Run
% ?- time(fibo(23,X)).
% % Wall 3865 ms, gc 94 ms, 71991 lips
% X = 46368.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GraalVM Python Version, Warm Warm Run
% ?- time(fibo(23,X)).
% % Wall 695 ms, gc 14 ms, 400356 lips
% X = 46368.

The "gc" timing measures Prolog garbage
collection. So you get the following percentage
of time spent in Prolog garbage collection:

Standard Python: 94 / 3865 = 2.4%

GraalVM Python: 14 / 695 = 2.0%

I consider this a good result. The Prolog
garbage collection is not utterly expensive.
The detecting the movement and performing

the variable movement on the trail, doesn't
take so much time. Currently the garbage collection
in Dogelog runtime is configured towards

synchronization with 60FPS, it does around
60-120 garbage collections per second. This
is less than what SWI-Prolog does.

SWI-Prolog has a much higher GC rate.

But I did not yet measure new version 0.9.6.

Mostowski Collapse schrieb:
> No its cooperative. Usually objects do get
> garbage collected by the native garbage collector
> of the host language in Dogelog runtime.
>
> The Prolog garbage collection is only to help
> the host language garbage collector when you have
> a deep recursion in Prolog.
>
> You can then reclaim intermediate variables.
> A simple example to test the slightly idio-
> syncratic Prolog garbage collection is:
>
> fibo(0, 1) :- !.
> fibo(1, 1) :- !.
> fibo(N, X) :-
>    M is N-1, fibo(M, Y),
>    L is M-1, fibo(L, Z),
>    X is Y+Z.
>
> When running fibo(30,X) SWI-Prolog does around
> 800 garbage collections to keep the environment
> small. But SWI-Prolog allocates all its objects
>
> only very seldom on the heap. It uses its own
> stack. On the other hand Dogelog runtime creates
> everything on the heap. And completely relies on
>
> the host language garbage collection. It only
> helps the host language garbage collection it
> that it performs from time to time this movement:
>
> Before:
>
>     -->[ A ]-->[ B ]-->[ C ]-->
>
> After:
>
>     -->[ A ]---------->[ C ]-->
>
> A,B,C are objects of type Variable. The above
> movement only happens for objects of type Variables
> from time to time. For objects of type Compound
>
> no modifications are done during Prolog garbage
> collection. The Prolog garbage collection aggressively
> nulls the Variable object B, and the host language
>
> later will garbage collect what the Variable object B
> was pointing to. But the Variable object B might
> nevertheless have point to something shared with
>
> some other Variable object or a local or a global
> Python variable, or a Compound. This is then all
> courtesy of the host language to decide reachability.
>
> Chris Angelico schrieb:
>> On Fri, Sep 17, 2021 at 7:17 AM Mostowski Collapse
>> <janburse@fastmail.fm> wrote:
>>>
>>> About Exceptions: Thats just building ISO core
>>> standard Prolog error terms.
>>>
>>> About Garbage Collection: Thats just Prolog
>>> garbage collection, which does shrink some
>>> single linked lists, which ordinary
>>> programmig language GC cannot do,
>>>
>>
>> Okay, so.... you're building your own garbage collection on top of
>> Python's, and you're wondering why it's slow?
>>
>> Change your code to not try to implement one language inside another,
>> and you'll see a massive performance improvement.
>>
>> ChrisA
>>
>

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<4b6a3ba7-3c91-4a7d-89e1-231c87cc573en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a0c:9146:: with SMTP id q64mr10376721qvq.38.1631876727180;
Fri, 17 Sep 2021 04:05:27 -0700 (PDT)
X-Received: by 2002:a37:6144:: with SMTP id v65mr9267130qkb.457.1631876726986;
Fri, 17 Sep 2021 04:05:26 -0700 (PDT)
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.python
Date: Fri, 17 Sep 2021 04:05:26 -0700 (PDT)
In-Reply-To: <si1lc0$mhq$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sfb25a$3a5$1@solani.org> <36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com> <shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com> <90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org> <7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com> <CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com> <mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com> <CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<CAPTjJmobSHAbubpmFmMtCuozCAQZ95ovVoj7qQLkDcXGRR3VJw@mail.gmail.com>
<mailman.736.1631842184.4164.python-list@python.org> <si1kuj$m9l$1@solani.org>
<si1lc0$mhq$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4b6a3ba7-3c91-4a7d-89e1-231c87cc573en@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 17 Sep 2021 11:05:27 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 138
 by: Mostowski Collapse - Fri, 17 Sep 2021 11:05 UTC

Concerning garbage collection, did a long term
measurement for the first time. I measured
LIPS for fibonacci numbers, i.e. time(fibo(23,X)).

Doing the same thing 16 times, how long does it take?
Here is a depiction how the LIPS relatively differ in each run:
https://gist.github.com/jburse/c85297e97091caf22d306dd8c8be12fe#gistcomment-3896343

I can also calculate the mean and standard deviation.
From this we see that Python has a 5% deviation, whereas
GraalVM has a 1% deviation. So the GraalVM garbage

collector works more evenly? Disclaimer, I measured
different time spans, the GraalVM is now 7x times
faster than Standard Python, so this is inconclusive.

Mostowski Collapse schrieb am Freitag, 17. September 2021 um 10:58:57 UTC+2:
> The Prolog garbage collection that does
> the movement on the variable trail is only
> a very small fraction of the runtime.
>
> The garbage collection time is measured.
> Some measurements with version 0.9.5
> took the following values:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % Standard Python Version, Warm Run
> % ?- time(fibo(23,X)).
> % % Wall 3865 ms, gc 94 ms, 71991 lips
> % X = 46368.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % GraalVM Python Version, Warm Warm Run
> % ?- time(fibo(23,X)).
> % % Wall 695 ms, gc 14 ms, 400356 lips
> % X = 46368.
>
> The "gc" timing measures Prolog garbage
> collection. So you get the following percentage
> of time spent in Prolog garbage collection:
>
> Standard Python: 94 / 3865 = 2.4%
>
> GraalVM Python: 14 / 695 = 2.0%
>
> I consider this a good result. The Prolog
> garbage collection is not utterly expensive.
> The detecting the movement and performing
>
> the variable movement on the trail, doesn't
> take so much time. Currently the garbage collection
> in Dogelog runtime is configured towards
>
> synchronization with 60FPS, it does around
> 60-120 garbage collections per second. This
> is less than what SWI-Prolog does.
>
> SWI-Prolog has a much higher GC rate.
>
> But I did not yet measure new version 0.9.6.
>
> Mostowski Collapse schrieb:
> > No its cooperative. Usually objects do get
> > garbage collected by the native garbage collector
> > of the host language in Dogelog runtime.
> >
> > The Prolog garbage collection is only to help
> > the host language garbage collector when you have
> > a deep recursion in Prolog.
> >
> > You can then reclaim intermediate variables.
> > A simple example to test the slightly idio-
> > syncratic Prolog garbage collection is:
> >
> > fibo(0, 1) :- !.
> > fibo(1, 1) :- !.
> > fibo(N, X) :-
> > M is N-1, fibo(M, Y),
> > L is M-1, fibo(L, Z),
> > X is Y+Z.
> >
> > When running fibo(30,X) SWI-Prolog does around
> > 800 garbage collections to keep the environment
> > small. But SWI-Prolog allocates all its objects
> >
> > only very seldom on the heap. It uses its own
> > stack. On the other hand Dogelog runtime creates
> > everything on the heap. And completely relies on
> >
> > the host language garbage collection. It only
> > helps the host language garbage collection it
> > that it performs from time to time this movement:
> >
> > Before:
> >
> > -->[ A ]-->[ B ]-->[ C ]-->
> >
> > After:
> >
> > -->[ A ]---------->[ C ]-->
> >
> > A,B,C are objects of type Variable. The above
> > movement only happens for objects of type Variables
> > from time to time. For objects of type Compound
> >
> > no modifications are done during Prolog garbage
> > collection. The Prolog garbage collection aggressively
> > nulls the Variable object B, and the host language
> >
> > later will garbage collect what the Variable object B
> > was pointing to. But the Variable object B might
> > nevertheless have point to something shared with
> >
> > some other Variable object or a local or a global
> > Python variable, or a Compound. This is then all
> > courtesy of the host language to decide reachability.
> >
> > Chris Angelico schrieb:
> >> On Fri, Sep 17, 2021 at 7:17 AM Mostowski Collapse
> >> <janb...@fastmail.fm> wrote:
> >>>
> >>> About Exceptions: Thats just building ISO core
> >>> standard Prolog error terms.
> >>>
> >>> About Garbage Collection: Thats just Prolog
> >>> garbage collection, which does shrink some
> >>> single linked lists, which ordinary
> >>> programmig language GC cannot do,
> >>>
> >>
> >> Okay, so.... you're building your own garbage collection on top of
> >> Python's, and you're wondering why it's slow?
> >>
> >> Change your code to not try to implement one language inside another,
> >> and you'll see a massive performance improvement.
> >>
> >> ChrisA
> >>
> >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<iql5tuFjaqU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Sat, 18 Sep 2021 15:49:16 +1200
Lines: 32
Message-ID: <iql5tuFjaqU1@mid.individual.net>
References: <sfb25a$3a5$1@solani.org> <shq6g2$9d$1@solani.org>
<shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net N6f5Zls+5QLiY4ha47fHiwQmzF1Q3FaGMPohPVq+GN8ARNoyez
Cancel-Lock: sha1:+I2ZqFTs7+//IB+2tKZt+h1eY8M=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <si07i1$ds$1@solani.org>
Content-Language: en-US
 by: Greg Ewing - Sat, 18 Sep 2021 03:49 UTC

On 17/09/21 7:56 am, Mostowski Collapse wrote:
> The trail in Dogelog
> Runtime is a single linked list:
>
>     -->[ A ]-->[ B ]-->[ C ]-->
>
> Now if B becomes unused, you need to rewire
> the trail, it should then look like:
>
>     -->[ A ]---------->[ C ]-->

Python has a way of creating weak references (see the weakref
module). You could set the trail up like this:

-->[*]-->[*]-->[*]-->
| | |
v v v
[w] [w] [w]
: : :
v v v
[A] [B] [C]

where [w] is a weak reference object. Then you could periodically
scan the trail looking for dead weakref objects and remove the
corresponding [*] node from the list.

You can also attach callbacks to weakref objects that are triggered
when the referenced object dies. You might be able to make use of
that to remove items from the trail instead of the periodic scanning.

--
Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<iql65nFkhdU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Sat, 18 Sep 2021 15:53:25 +1200
Lines: 22
Message-ID: <iql65nFkhdU1@mid.individual.net>
References: <sfb25a$3a5$1@solani.org> <shnh7g$hms$2@solani.org>
<shoeic$sq0$1@ciao.gmane.io>
<mailman.720.1631568443.4164.python-list@python.org>
<shq65d$vro$1@solani.org> <shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<CAPTjJmogMEfzMb5a=O34wwa290gr+=7fQYdN9SDtdtCX_dS2AQ@mail.gmail.com>
<sht6ld$83j$1@solani.org>
<mailman.725.1631726813.4164.python-list@python.org>
<c9d2e41c-ff1d-4577-ae3d-038d6b690b07n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 9DypLPH0++wgBTSOHA7HVQZoc4HeYHzov48zbu/v+db5aYSmPW
Cancel-Lock: sha1:DDlQ668iZxTokF/TiwouY8ilZqs=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <c9d2e41c-ff1d-4577-ae3d-038d6b690b07n@googlegroups.com>
Content-Language: en-US
 by: Greg Ewing - Sat, 18 Sep 2021 03:53 UTC

On 16/09/21 6:13 am, Mostowski Collapse wrote:
> So in Python I now do the following:
>
> peek = kb.get(functor, NotImplemented)
> if peek is not NotImplemented:

If you're able to use None instead of NotImplemented, you
could simplify that to

peek = kb.get(functor)
if peek:
...

> But if get() in Python is implemented under the hood with
> exception handling. ... then Python get() will probably be quite slow.

No, it doesn't use exceptions as far as I know. It should
be fairly fast.

--
Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<iql88gFv0rU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Sat, 18 Sep 2021 16:29:03 +1200
Lines: 17
Message-ID: <iql88gFv0rU1@mid.individual.net>
References: <sfb25a$3a5$1@solani.org> <shnh7g$hms$2@solani.org>
<shoeic$sq0$1@ciao.gmane.io>
<mailman.720.1631568443.4164.python-list@python.org>
<shq65d$vro$1@solani.org> <shq6g2$9d$1@solani.org> <shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <iqi91hFe0llU1@mid.individual.net>
<si1kbq$lt3$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net cDQHtRa9/rxCDIj1aNMhEAUryqz7huRlXqNKn2w77bVB+LqAZK
Cancel-Lock: sha1:BJ2fdie2Gn0+2zObc6RvKg1NWYg=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <si1kbq$lt3$1@solani.org>
Content-Language: en-US
 by: Greg Ewing - Sat, 18 Sep 2021 04:29 UTC

On 17/09/21 8:41 pm, Mostowski Collapse wrote:
> Are exceptions
> blocks in Python cheap or expensive? Are they like
> in Java, some code annotation, or like in Go
> programming language pushing some panic handler?

They're not free, but they're not hugely expensive either.
Don't be afraid to use them when it makes sense to do so.

I'm not sure what you mean by "some code annotations",
so I don't know how to answer that question. I suspect
that the way exceptions are implemented in the JVM is
similar to the way CPython does it, but I don't know
a lot about the JVM.

--
Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ad4:4ab1:: with SMTP id i17mr17689602qvx.11.1632000534958;
Sat, 18 Sep 2021 14:28:54 -0700 (PDT)
X-Received: by 2002:a05:620a:1453:: with SMTP id i19mr16985786qkl.40.1632000534750;
Sat, 18 Sep 2021 14:28:54 -0700 (PDT)
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.python
Date: Sat, 18 Sep 2021 14:28:54 -0700 (PDT)
In-Reply-To: <iql5tuFjaqU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sfb25a$3a5$1@solani.org> <shq6g2$9d$1@solani.org>
<shsstq$2ut$1@solani.org> <d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org> <36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com> <shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com> <90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org> <7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com> <CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com> <mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com> <CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org> <iql5tuFjaqU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 18 Sep 2021 21:28:54 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 51
 by: Mostowski Collapse - Sat, 18 Sep 2021 21:28 UTC

Yeah, it seems weak references could indeed spare
me mark_term(). But then I am stil left with sweep_trail().
I did not yet measure what takes more time mark_term()
or sweep_trail(). The displayed "gc" is the sum of both.

From what I have seen, very large trail practically reduced
to a zero trail during Prolog GC, I am assuming that
mark_term() is not the working horse. Usually mark_term()
only marks what is not-Garbage, and sweep_trail()

has to deal with Garbage and not-Garbage. And there
is usually a lot of Garbage, much more than not-Garbage.
Finding the objects that survive, is like finding the needle
in the haystack, except we do not have to scan the

haystack, the needles are on the goal list. But afterwards,
the second pass, scanning the trail is the work of Heracles
cleaning the Augeas stables. This scan is trowing away the
hay and keeping the needles.

Greg Ewing schrieb am Samstag, 18. September 2021 um 05:49:37 UTC+2:
> On 17/09/21 7:56 am, Mostowski Collapse wrote:
> > The trail in Dogelog
> > Runtime is a single linked list:
> >
> > -->[ A ]-->[ B ]-->[ C ]-->
> >
> > Now if B becomes unused, you need to rewire
> > the trail, it should then look like:
> >
> > -->[ A ]---------->[ C ]-->
> Python has a way of creating weak references (see the weakref
> module). You could set the trail up like this:
>
> -->[*]-->[*]-->[*]-->
> | | |
> v v v
> [w] [w] [w]
> : : :
> v v v
> [A] [B] [C]
>
> where [w] is a weak reference object. Then you could periodically
> scan the trail looking for dead weakref objects and remove the
> corresponding [*] node from the list.
>
> You can also attach callbacks to weakref objects that are triggered
> when the referenced object dies. You might be able to make use of
> that to remove items from the trail instead of the periodic scanning.
>
> --
> Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<mailman.743.1632016663.4164.python-list@python.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Sun, 19 Sep 2021 11:57:29 +1000
Lines: 23
Message-ID: <mailman.743.1632016663.4164.python-list@python.org>
References: <sfb25a$3a5$1@solani.org> <shq6g2$9d$1@solani.org>
<shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 7UlGz9WVTPiXRnhP7e6RzQnWrBoGO5lmSxmh5ppolpKA==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=UZD4/N7Y;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.078
X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'sun,': 0.07; 'something,':
0.09; 'assuming': 0.16; 'both.': 0.16; 'chrisa': 0.16;
'displayed': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris
angelico': 0.16; 'indeed': 0.16; 'marks': 0.16; 'practically':
0.16; 'subject:ANN': 0.16; 'wrote:': 0.16; 'python': 0.16;
'to:addr:python-list': 0.20; 'all,': 0.20; 'language': 0.21;
'seems': 0.26; 'takes': 0.31; 'objects': 0.32; 'sep': 0.32;
'to:name:python': 0.32; 'zero': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34;
'received:209.85.166': 0.35; 'from:addr:gmail.com': 0.35;
'received:209.85': 0.37; 'could': 0.38; 'received:209': 0.39;
'finding': 0.39; 'let': 0.66; 'during': 0.69; '2021': 0.71;
'care': 0.71; 'deal': 0.73; 'subject:2021': 0.76; 'left': 0.83;
'garbage': 0.84; 'literally': 0.84; 'needle': 0.84; 'spare': 0.84;
'weak': 0.84; 'collapse': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=Yd32YPMnrGY1LvFa6biYCxoxgt126SlRkzajF20NFTc=;
b=UZD4/N7Y3RFjUw7whxN1w0DBca+t6QKOmoVQNdBCcK4lkOVYUTbqiDeHvLQIwJHUAh
FoPw3Esu0ZacoCX/RT0CTtG9KWaK8o9LufSRV37LuLuEnZ7mva2dFYZqT387h9uai8eu
Q5lwhCix9bin9NdqDQt6F7L0LqtmwdiF+DeTXEIgfEPeWaEnPSrrXRjeMiB9YlHdIF6U
/dla20IAb1EuxSmHv52n55i3H2zRquD0ws0yDsmdMtnSgPj0okh4oI3hXhkXTWjpehEr
J1g83ZVibGWe/uqg+eqkXLdkr/FWLCbHVhHl0ae0dUx2NdH0OHzsIrWeFLCrNwZ4p6Ps
fVGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=Yd32YPMnrGY1LvFa6biYCxoxgt126SlRkzajF20NFTc=;
b=BFEnqPysrJTM/jOsRYScGEy8IB2QVsgcxxmC5ikVpxXiYqJ6fTkAPVVOoePT/wuVSh
UwM0sxHo/w4xzC4C5EncYHNLm1gsrHwpYoLyKEWgjP15I/b/ibm+GvQ9kxPwMgK2YzzG
XCXeO4+0xc7LjEWTOC2HQNwLQhnj/QQRC8we7MtuXTCEHqNr+70xu45s5xcAhQu9jaWk
zfNRXzaviEe4VjtCSXP2ntjoCopo1Oh3Wj+vMTDxiIz59avSOyqrKtkr8ParDLoI++5O
YNnQFCOtCh8Sq0v6M6GtBfioAMR3F2dL3g1Mi+CYikkf0e/OAkhVRckoXDps+pV1HXU5
stlw==
X-Gm-Message-State: AOAM530DOi1XeTOmmt6mooLDvYdvhSSPzZLd6lHw7pEkAqSTmtwFBfBh
DZBT2nDhOs7WDLw/LPj52JAbOyy8IXXxgjgQF/s9Ecr4JeI=
X-Google-Smtp-Source: ABdhPJzOCFrnG0L3kNx/yg58eJwVkgH/kcgevR2y2n6XO/7rc0xLglQctrzqcuL1ei3p4oJut0LnzWlrWeM2OBvj90Q=
X-Received: by 2002:a6b:5a1a:: with SMTP id o26mr14073987iob.40.1632016660886;
Sat, 18 Sep 2021 18:57:40 -0700 (PDT)
In-Reply-To: <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
X-Mailman-Original-References: <sfb25a$3a5$1@solani.org>
<shq6g2$9d$1@solani.org>
<shsstq$2ut$1@solani.org>
<d5c7d9eb-5b34-4c1f-8c04-2d31425268f2n@googlegroups.com>
<sht6ld$83j$1@solani.org> <shtdav$v8r$1@gioia.aioe.org>
<36358b16-6985-4e39-8b1e-6bdb62c8725an@googlegroups.com>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
 by: Chris Angelico - Sun, 19 Sep 2021 01:57 UTC

On Sun, Sep 19, 2021 at 11:46 AM Mostowski Collapse <bursejan@gmail.com> wrote:
>
> Yeah, it seems weak references could indeed spare
> me mark_term(). But then I am stil left with sweep_trail().
> I did not yet measure what takes more time mark_term()
> or sweep_trail(). The displayed "gc" is the sum of both.
>
> From what I have seen, very large trail practically reduced
> to a zero trail during Prolog GC, I am assuming that
> mark_term() is not the working horse. Usually mark_term()
> only marks what is not-Garbage, and sweep_trail()
>
> has to deal with Garbage and not-Garbage. And there
> is usually a lot of Garbage, much more than not-Garbage.
> Finding the objects that survive, is like finding the needle
> in the haystack, except we do not have to scan the

If you stop referring to something, it is garbage. Python will dispose of it.

You literally need to do nothing at all, and let the language take
care of things.

ChrisA

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si6tl1$csn$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Sun, 19 Sep 2021 10:50:40 +0200
Message-ID: <si6tl1$csn$1@solani.org>
References: <sfb25a$3a5$1@solani.org>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 19 Sep 2021 08:50:42 -0000 (UTC)
Injection-Info: solani.org;
logging-data="13207"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
In-Reply-To: <mailman.743.1632016663.4164.python-list@python.org>
Cancel-Lock: sha1:STGtWj8v2nWLxmoUxD7WFpt+emE=
X-User-ID: eJwFwYEBACAEBMCViH81jsT+I3QHo7LCCToG8womc3MTBwaiREcDLpWphsMu7D6rV5B5zVNfiF8Zbun8PmYU+Q==
 by: Mostowski Collapse - Sun, 19 Sep 2021 08:50 UTC

I am refering to:

Greg Ewing schrieb:
> where [w] is a weak reference object. Then you could periodically
> scan the trail looking for dead weakref objects and remove the
> corresponding [*] node from the list.
>
> You can also attach callbacks to weakref objects that are triggered
> when the referenced object dies. You might be able to make use of
> that to remove items from the trail instead of the periodic scanning.

Question to Chris Angelico: If I stay with my
sweep_trail(), which is the periodically scanning,
I can use a single linked list.

On the other hand if I would use the trigger
from Python, I possibly would need a double linked
list, to remove an element.

Chris Angelico, is there a third option, that I have
overlooked? Single linked list uses less space
than double linked list, this why I go with scan.

Chris Angelico schrieb:
> On Sun, Sep 19, 2021 at 11:46 AM Mostowski Collapse <bursejan@gmail.com> wrote:
>>
>> Yeah, it seems weak references could indeed spare
>> me mark_term(). But then I am stil left with sweep_trail().
>> I did not yet measure what takes more time mark_term()
>> or sweep_trail(). The displayed "gc" is the sum of both.
>>
>> From what I have seen, very large trail practically reduced
>> to a zero trail during Prolog GC, I am assuming that
>> mark_term() is not the working horse. Usually mark_term()
>> only marks what is not-Garbage, and sweep_trail()
>>
>> has to deal with Garbage and not-Garbage. And there
>> is usually a lot of Garbage, much more than not-Garbage.
>> Finding the objects that survive, is like finding the needle
>> in the haystack, except we do not have to scan the
>
> If you stop referring to something, it is garbage. Python will dispose of it.
>
> You literally need to do nothing at all, and let the language take
> care of things.
>
> ChrisA
>

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<7497b77f-f4cc-4b36-99e4-c1cff741e4c4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ad4:4ab1:: with SMTP id i17mr19287388qvx.11.1632042182215;
Sun, 19 Sep 2021 02:03:02 -0700 (PDT)
X-Received: by 2002:a37:9307:: with SMTP id v7mr18334112qkd.371.1632042182040;
Sun, 19 Sep 2021 02:03:02 -0700 (PDT)
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.python
Date: Sun, 19 Sep 2021 02:03:01 -0700 (PDT)
In-Reply-To: <si6tl1$csn$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sfb25a$3a5$1@solani.org> <3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org> <d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com> <shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com> <58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com> <mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com> <CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net> <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7497b77f-f4cc-4b36-99e4-c1cff741e4c4n@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 19 Sep 2021 09:03:02 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 78
 by: Mostowski Collapse - Sun, 19 Sep 2021 09:03 UTC

The trail itself can possibly not be eliminated. Its like a
database logfile. The trail is used during backtracking to
undo variable bindings. Which is like a database rollback.

Here is an example where a tail is used:

/* X equals 1 or X equals 2 */
?- X=1; X=2.
X = 1;
X = 2.

In the first answer the trail will have recorded that X
was bound to 1. When the second answer is requested,
the trail is used to unbind X, so that it can be bound to 2.

The Prolog garbage collection is a compactification
of the trail. Maybe databases can do the same with their
logfiles, for example if a logfile contains an insert and

then a delete of the same row, then these two logentries
can be merged. The only difference here is that Prolog
garbage collection primarily compactes towards trail

entries that have become irrelevant. This is part of
intelligent bracktracking, and backjumping over multiple
goal invocations, that didn't record a choice point.

The Prolog garbage collection can compact the trail
before backjumping happens. So that Prolog search
has more space available.

Mostowski Collapse schrieb am Sonntag, 19. September 2021 um 10:51:03 UTC+2:
> I am refering to:
>
> Greg Ewing schrieb:
> > where [w] is a weak reference object. Then you could periodically
> > scan the trail looking for dead weakref objects and remove the
> > corresponding [*] node from the list.
> >
> > You can also attach callbacks to weakref objects that are triggered
> > when the referenced object dies. You might be able to make use of
> > that to remove items from the trail instead of the periodic scanning.
> Question to Chris Angelico: If I stay with my
> sweep_trail(), which is the periodically scanning,
> I can use a single linked list.
>
> On the other hand if I would use the trigger
> from Python, I possibly would need a double linked
> list, to remove an element.
>
> Chris Angelico, is there a third option, that I have
> overlooked? Single linked list uses less space
> than double linked list, this why I go with scan.
>
> Chris Angelico schrieb:
> > On Sun, Sep 19, 2021 at 11:46 AM Mostowski Collapse <burs...@gmail.com> wrote:
> >>
> >> Yeah, it seems weak references could indeed spare
> >> me mark_term(). But then I am stil left with sweep_trail().
> >> I did not yet measure what takes more time mark_term()
> >> or sweep_trail(). The displayed "gc" is the sum of both.
> >>
> >> From what I have seen, very large trail practically reduced
> >> to a zero trail during Prolog GC, I am assuming that
> >> mark_term() is not the working horse. Usually mark_term()
> >> only marks what is not-Garbage, and sweep_trail()
> >>
> >> has to deal with Garbage and not-Garbage. And there
> >> is usually a lot of Garbage, much more than not-Garbage.
> >> Finding the objects that survive, is like finding the needle
> >> in the haystack, except we do not have to scan the
> >
> > If you stop referring to something, it is garbage. Python will dispose of it.
> >
> > You literally need to do nothing at all, and let the language take
> > care of things.
> >
> > ChrisA
> >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<mailman.752.1632076433.4164.python-list@python.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Mon, 20 Sep 2021 04:33:39 +1000
Lines: 37
Message-ID: <mailman.752.1632076433.4164.python-list@python.org>
References: <sfb25a$3a5$1@solani.org>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de li35DZ2Sn3k4uNqbpU5bTwLDeCM7rUIfCb1il/70Pkcg==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=IKFF7OMj;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.170
X-Spam-Level: *
X-Spam-Evidence: '*H*': 0.66; '*S*': 0.00; 'enough.': 0.09; 'chrisa':
0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'greg': 0.16; 'node': 0.16; 'objects.': 0.16; 'subject:ANN': 0.16;
'things,': 0.16; 'triggered': 0.16; 'wrote:': 0.16; 'python':
0.16; 'instead': 0.17; 'uses': 0.19; 'to:addr:python-list': 0.20;
'language': 0.21; 'code': 0.23; 'list,': 0.24; 'python,': 0.25;
'space': 0.26; 'object': 0.26; 'creating': 0.27; 'chris': 0.28;
'question': 0.32; 'attach': 0.32; 'concept': 0.32; 'objects':
0.32; 'sep': 0.32; 'to:name:python': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33; 'able':
0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'received:209.85.166': 0.35; 'from:addr:gmail.com': 0.35; 'mon,':
0.36; 'possibly': 0.36; 'received:209.85': 0.37; 'way': 0.38;
'could': 0.38; 'received:209': 0.39; 'single': 0.39; 'enough':
0.39; 'list': 0.39; 'use': 0.39; 'double': 0.40; 'hand': 0.40;
'try': 0.40; 'reference': 0.60; 'best': 0.61; 'stay': 0.61; 'to:':
0.62; 'clear': 0.64; 'your': 0.64; 'top': 0.65; 'well': 0.65;
'less': 0.65; 'let': 0.66; '20,': 0.67; 'nearly': 0.67; 'that,':
0.67; 'items': 0.68; 'know.': 0.68; '2021': 0.71; 'offer': 0.71;
'subject:2021': 0.76; 'dead': 0.81; 'referenced': 0.84; 'weak':
0.84; 'collapse': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=AQyp8ZOCCnqc6HfkM831IiQtHrzjVkABGRusmMtocbM=;
b=IKFF7OMjMgG/BMi52o/B6jPjf8vVJiFerMln+AssMmLywbviAZMKM8VLC2kuBA0ud4
0eSpGG4iFO1PDRCEVkVchjg5SM8O8iTsyFUVrAYt5hJiH8dWdk5tzZT/VB4XnKgEfeL0
93jRpQzI7tM/CvS8vX3tNeiql8eK8xem1r5bA/Q+FGxwKltgqjwyvg2E0l/u3R6bCZ4E
8OR8fuS0M0iRjlIUJI5lVlbEE6WQi/RI5llu54UrfcsSqS48I8/NjYxp5U48yx7ZVhdG
PS4F2P+3cTVPryDrYtlc+t4QgYWY1qRVb/Wzfl1XGi9p+rRC/89d14O7C/PblzD5ST1Q
rFvw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=AQyp8ZOCCnqc6HfkM831IiQtHrzjVkABGRusmMtocbM=;
b=wjjRX2CHxF2ldxl4Yvfnfwu4FMVwDoSF5hERDh5Hz+RJzZPnW1hSx3f/5UpJSVXu3i
SL3xwRSSerfbJsInLNKF8Mzub/o9dOg1vfGfTBYBEsYRbhUz5O6scCKks3DsUZ4C19YM
jM6sTIo7MbTe69xBkllerCLGqwqKPTybjKYBMYwqUv5mM/e/kP+ogoqYQ0hqVtja0xoz
XH/Q+JNYt6AwgKJPFgtuqeFgamtluVpDdeGfIkw7Lv+yC+My9eO5dssZBHt5LmXiSmFw
ii803uczoskEAVfmlmJeueK8rhOeTeFI1uf1z84aZ1pjRafJ1Wq5X6FSK81oHtcvSJ8h
mdHw==
X-Gm-Message-State: AOAM532zx752fAQd/rZVIJpicJuWIpeTWrXM7BfcBwL/DNzwadgQis1K
lZT00vbvUSQCPN5Pe8geWHvK1f6ncCWq02K1fSXVaPs84OI=
X-Google-Smtp-Source: ABdhPJwW9ftLeWyd7QSitJAYj7KnDDUTBr/klgGyjrp7KY4uGXtY+5FYCvCgkSJDb2Gv00GPIeCL0PNTBBMQEcdyQiE=
X-Received: by 2002:a6b:6918:: with SMTP id e24mr15904780ioc.71.1632076430553;
Sun, 19 Sep 2021 11:33:50 -0700 (PDT)
In-Reply-To: <si6tl1$csn$1@solani.org>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
X-Mailman-Original-References: <sfb25a$3a5$1@solani.org>
<3b41cebb-7f8e-4250-b290-0734f59dbd63n@googlegroups.com>
<shtenk$v8r$3@gioia.aioe.org>
<d7914bb4-c388-4379-90a6-eca10b8af458n@googlegroups.com>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
 by: Chris Angelico - Sun, 19 Sep 2021 18:33 UTC

On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janburse@fastmail.fm> wrote:
>
> I am refering to:
>
> Greg Ewing schrieb:
> > where [w] is a weak reference object. Then you could periodically
> > scan the trail looking for dead weakref objects and remove the
> > corresponding [*] node from the list.
> >
> > You can also attach callbacks to weakref objects that are triggered
> > when the referenced object dies. You might be able to make use of
> > that to remove items from the trail instead of the periodic scanning.
>
> Question to Chris Angelico: If I stay with my
> sweep_trail(), which is the periodically scanning,
> I can use a single linked list.
>
> On the other hand if I would use the trigger
> from Python, I possibly would need a double linked
> list, to remove an element.
>
> Chris Angelico, is there a third option, that I have
> overlooked? Single linked list uses less space
> than double linked list, this why I go with scan.
>

I don't know. I don't understand your code well enough to offer advice
like that, because *your code is too complicated* and not nearly clear
enough.

But however it is that you're doing things, the best way is almost
always to directly refer to objects. Don't fiddle around with creating
your own concept of a doubly-linked list and a set of objects; just
refer directly to the objects. Let Python be Python, don't try to
build your own language on top of it.

ChrisA

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si841q$dbg$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Sun, 19 Sep 2021 21:46:01 +0200
Message-ID: <si841q$dbg$1@solani.org>
References: <sfb25a$3a5$1@solani.org>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.752.1632076433.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 19 Sep 2021 19:46:02 -0000 (UTC)
Injection-Info: solani.org;
logging-data="13680"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
Cancel-Lock: sha1:QQMJFudTjh6q8JKnC8CxaqhdWUg=
In-Reply-To: <mailman.752.1632076433.4164.python-list@python.org>
X-User-ID: eJwFwYEBwDAEBMCVhDz9cQj2H6F3MD/+4jr8YrGssdsAhVraQz0TlIrRaVhmsddeWvXyGb7clg5Xq8wN/ma6Fos=
 by: Mostowski Collapse - Sun, 19 Sep 2021 19:46 UTC

sympy also builds a language on top of Python.
pandas also builds a language on top of Python.

Is there some pope that says this wouldn't be
allowed, I dont think so, otherwise sympy, pandas, etc..

wouldn't exist. I dont understand your argument.

Chris Angelico schrieb:
> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janburse@fastmail.fm> wrote:
>>
>> I am refering to:
>>
>> Greg Ewing schrieb:
>> > where [w] is a weak reference object. Then you could periodically
>> > scan the trail looking for dead weakref objects and remove the
>> > corresponding [*] node from the list.
>> >
>> > You can also attach callbacks to weakref objects that are triggered
>> > when the referenced object dies. You might be able to make use of
>> > that to remove items from the trail instead of the periodic scanning.
>>
>> Question to Chris Angelico: If I stay with my
>> sweep_trail(), which is the periodically scanning,
>> I can use a single linked list.
>>
>> On the other hand if I would use the trigger
>> from Python, I possibly would need a double linked
>> list, to remove an element.
>>
>> Chris Angelico, is there a third option, that I have
>> overlooked? Single linked list uses less space
>> than double linked list, this why I go with scan.
>>
>
> I don't know. I don't understand your code well enough to offer advice
> like that, because *your code is too complicated* and not nearly clear
> enough.
>
> But however it is that you're doing things, the best way is almost
> always to directly refer to objects. Don't fiddle around with creating
> your own concept of a doubly-linked list and a set of objects; just
> refer directly to the objects. Let Python be Python, don't try to
> build your own language on top of it.
>
> ChrisA
>

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<775ec5c8-8211-42ee-99c1-86d6e536fb71n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ae9:ec0f:: with SMTP id h15mr20761924qkg.224.1632081751536;
Sun, 19 Sep 2021 13:02:31 -0700 (PDT)
X-Received: by 2002:a37:a155:: with SMTP id k82mr7097370qke.349.1632081751341;
Sun, 19 Sep 2021 13:02:31 -0700 (PDT)
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.python
Date: Sun, 19 Sep 2021 13:02:31 -0700 (PDT)
In-Reply-To: <si841q$dbg$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sfb25a$3a5$1@solani.org> <90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org> <7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com> <CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com> <mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com> <CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net> <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.752.1632076433.4164.python-list@python.org> <si841q$dbg$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <775ec5c8-8211-42ee-99c1-86d6e536fb71n@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 19 Sep 2021 20:02:31 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 97
 by: Mostowski Collapse - Sun, 19 Sep 2021 20:02 UTC

Also I nowhere wrote that I would use doubly-linked list or
a set of objects. The trail is neither, its a single linked list. I
also refer directly to objects, I do not need the trail to refer

to objects. The Prolog trail is only a logbook. The Prolog trail
has similarity to a database log:

transaction journal, database log, binary log or audit **trail**
https://en.wikipedia.org/wiki/Transaction_log

Do you say Python should not be used to implement
such things? In my opinion, Python has a high potential
to implement Prolog, because it has also ast.parse()

and compile(). But I do not yet have a showcase that uses
these features of Python to compile Prolog. I dont work 24/7
and I cannot clone myself. Currently the Prolog code is interpreted.

I have a prototype where Prolog code is compiled into JavaScript,
but I did not yet try this approach with Python. Here you see how
JavaScript closures are generated, a first prototype:

const alt4 = make_defined([new Clause(1, [0, 0], function(
display, actual, cont) {return(new Compound(".", [new Compound(
"==", [deref(actual.args[0]), "end_of_file"]), new Compound(
".", [new Compound("$CUT", [deref(display[0])]), cont
])]))}, 0, undefined), new Clause(1, [0, 0], function(
display, actual, cont) {return(new Compound(".", [new Compound(
"expand_include", [deref(actual.args[0]), deref(actual.args[1]
), display[0] = new Variable()]), new Compound(".",
[new Compound("handle_term", [deref(display[0])]), new Compound(
".", ["fail", cont])])]))}, -1, undefined)]);

add("next_term", 1, new Clause(2, [0], function(display, actual,
cont) {return(new Compound(".", [new Compound("read_term",
[deref(actual.args[0]), display[0] = new Variable(),
new Compound(".", [new Compound("variable_names", [
display[1] = new Variable()]), "[]"])]), new Compound(
".", [new Compound(alt4, [deref(display[0]), deref(
display[1])]), cont])]))}, -1, undefined));

https://github.com/jburse/dogelog-moon/issues/184

Will do the same for Python in the next weeks. Then later this approach
will be combined with a few planned optimizations. So far got a 25%
speed increase for JavaScript with this new compilation scheme, but

there is no official release out yet, that features this approach. And
there should be much more in it, also for Python.

Mostowski Collapse schrieb am Sonntag, 19. September 2021 um 21:46:20 UTC+2:
> sympy also builds a language on top of Python.
> pandas also builds a language on top of Python.
>
> Is there some pope that says this wouldn't be
> allowed, I dont think so, otherwise sympy, pandas, etc..
>
> wouldn't exist. I dont understand your argument.
>
> Chris Angelico schrieb:
> > On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janb...@fastmail.fm> wrote:
> >>
> >> I am refering to:
> >>
> >> Greg Ewing schrieb:
> >> > where [w] is a weak reference object. Then you could periodically
> >> > scan the trail looking for dead weakref objects and remove the
> >> > corresponding [*] node from the list.
> >> >
> >> > You can also attach callbacks to weakref objects that are triggered
> >> > when the referenced object dies. You might be able to make use of
> >> > that to remove items from the trail instead of the periodic scanning.
> >>
> >> Question to Chris Angelico: If I stay with my
> >> sweep_trail(), which is the periodically scanning,
> >> I can use a single linked list.
> >>
> >> On the other hand if I would use the trigger
> >> from Python, I possibly would need a double linked
> >> list, to remove an element.
> >>
> >> Chris Angelico, is there a third option, that I have
> >> overlooked? Single linked list uses less space
> >> than double linked list, this why I go with scan.
> >>
> >
> > I don't know. I don't understand your code well enough to offer advice
> > like that, because *your code is too complicated* and not nearly clear
> > enough.
> >
> > But however it is that you're doing things, the best way is almost
> > always to directly refer to objects. Don't fiddle around with creating
> > your own concept of a doubly-linked list and a set of objects; just
> > refer directly to the objects. Let Python be Python, don't try to
> > build your own language on top of it.
> >
> > ChrisA
> >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<3dafd08a-ff7e-438f-bbd9-25559cbc6ef8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ae9:ec0f:: with SMTP id h15mr20828778qkg.224.1632082938469;
Sun, 19 Sep 2021 13:22:18 -0700 (PDT)
X-Received: by 2002:ad4:566c:: with SMTP id bm12mr19985982qvb.58.1632082938361;
Sun, 19 Sep 2021 13:22:18 -0700 (PDT)
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.python
Date: Sun, 19 Sep 2021 13:22:18 -0700 (PDT)
In-Reply-To: <775ec5c8-8211-42ee-99c1-86d6e536fb71n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sfb25a$3a5$1@solani.org> <90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org> <7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com> <CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com> <mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com> <CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net> <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.752.1632076433.4164.python-list@python.org> <si841q$dbg$1@solani.org>
<775ec5c8-8211-42ee-99c1-86d6e536fb71n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3dafd08a-ff7e-438f-bbd9-25559cbc6ef8n@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 19 Sep 2021 20:22:18 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 118
 by: Mostowski Collapse - Sun, 19 Sep 2021 20:22 UTC

Please be patient. A big problem with development can be
burnout. So I am trying to slow down things at the moment.
The ideas are easy to sketch, but implementation can take

weeks. Here is the idea again in a nutshell: use ast.parse()
and compile(). Or build directly an AST, not using the string
detour as in ast.parse(). How long will it take to have a

working solution? 11 years ago there was:

Pyrolog: Prolog written in Python using PyPy's RPython tool chain
https://www.reddit.com/r/prolog/comments/fbuz1/pyrolog_prolog_written_in_python_using_pypys/

RPython is a framework for implementing interpreters and virtual
machines for programming languages, especially dynamic languages.
https://rpython.readthedocs.io/en/latest/faq.html

Currently I am not planning to use RPython, want to to use
standard Python AST and compile(). Might have a look at
RPython or similar stuff later.

Mostowski Collapse schrieb am Sonntag, 19. September 2021 um 22:02:41 UTC+2:
> Also I nowhere wrote that I would use doubly-linked list or
> a set of objects. The trail is neither, its a single linked list. I
> also refer directly to objects, I do not need the trail to refer
>
> to objects. The Prolog trail is only a logbook. The Prolog trail
> has similarity to a database log:
>
> transaction journal, database log, binary log or audit **trail**
> https://en.wikipedia.org/wiki/Transaction_log
>
> Do you say Python should not be used to implement
> such things? In my opinion, Python has a high potential
> to implement Prolog, because it has also ast.parse()
>
> and compile(). But I do not yet have a showcase that uses
> these features of Python to compile Prolog. I dont work 24/7
> and I cannot clone myself. Currently the Prolog code is interpreted.
>
> I have a prototype where Prolog code is compiled into JavaScript,
> but I did not yet try this approach with Python. Here you see how
> JavaScript closures are generated, a first prototype:
>
> const alt4 = make_defined([new Clause(1, [0, 0], function(
> display, actual, cont) {return(new Compound(".", [new Compound(
> "==", [deref(actual.args[0]), "end_of_file"]), new Compound(
> ".", [new Compound("$CUT", [deref(display[0])]), cont
> ])]))}, 0, undefined), new Clause(1, [0, 0], function(
> display, actual, cont) {return(new Compound(".", [new Compound(
> "expand_include", [deref(actual.args[0]), deref(actual.args[1]
> ), display[0] = new Variable()]), new Compound(".",
> [new Compound("handle_term", [deref(display[0])]), new Compound(
> ".", ["fail", cont])])]))}, -1, undefined)]);
>
> add("next_term", 1, new Clause(2, [0], function(display, actual,
> cont) {return(new Compound(".", [new Compound("read_term",
> [deref(actual.args[0]), display[0] = new Variable(),
> new Compound(".", [new Compound("variable_names", [
> display[1] = new Variable()]), "[]"])]), new Compound(
> ".", [new Compound(alt4, [deref(display[0]), deref(
> display[1])]), cont])]))}, -1, undefined));
>
> https://github.com/jburse/dogelog-moon/issues/184
>
> Will do the same for Python in the next weeks. Then later this approach
> will be combined with a few planned optimizations. So far got a 25%
> speed increase for JavaScript with this new compilation scheme, but
>
> there is no official release out yet, that features this approach. And
> there should be much more in it, also for Python.
> Mostowski Collapse schrieb am Sonntag, 19. September 2021 um 21:46:20 UTC+2:
> > sympy also builds a language on top of Python.
> > pandas also builds a language on top of Python.
> >
> > Is there some pope that says this wouldn't be
> > allowed, I dont think so, otherwise sympy, pandas, etc..
> >
> > wouldn't exist. I dont understand your argument.
> >
> > Chris Angelico schrieb:
> > > On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janb...@fastmail.fm> wrote:
> > >>
> > >> I am refering to:
> > >>
> > >> Greg Ewing schrieb:
> > >> > where [w] is a weak reference object. Then you could periodically
> > >> > scan the trail looking for dead weakref objects and remove the
> > >> > corresponding [*] node from the list.
> > >> >
> > >> > You can also attach callbacks to weakref objects that are triggered
> > >> > when the referenced object dies. You might be able to make use of
> > >> > that to remove items from the trail instead of the periodic scanning.
> > >>
> > >> Question to Chris Angelico: If I stay with my
> > >> sweep_trail(), which is the periodically scanning,
> > >> I can use a single linked list.
> > >>
> > >> On the other hand if I would use the trigger
> > >> from Python, I possibly would need a double linked
> > >> list, to remove an element.
> > >>
> > >> Chris Angelico, is there a third option, that I have
> > >> overlooked? Single linked list uses less space
> > >> than double linked list, this why I go with scan.
> > >>
> > >
> > > I don't know. I don't understand your code well enough to offer advice
> > > like that, because *your code is too complicated* and not nearly clear
> > > enough.
> > >
> > > But however it is that you're doing things, the best way is almost
> > > always to directly refer to objects. Don't fiddle around with creating
> > > your own concept of a doubly-linked list and a set of objects; just
> > > refer directly to the objects. Let Python be Python, don't try to
> > > build your own language on top of it.
> > >
> > > ChrisA
> > >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<iqptbaFsdr7U1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Mon, 20 Sep 2021 10:53:30 +1200
Lines: 15
Message-ID: <iqptbaFsdr7U1@mid.individual.net>
References: <sfb25a$3a5$1@solani.org>
<90e326fc-dc3d-43ff-a8ea-630f4740c8e2n@googlegroups.com>
<shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.752.1632076433.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net NH5RT/sOjwJwTzRFkY5O7Ax6waZu9AsxRxrIqgSE/OAxlQ9tDf
Cancel-Lock: sha1:CxE7iKAnDlsw/PlEghB7HNC5KBo=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <mailman.752.1632076433.4164.python-list@python.org>
Content-Language: en-US
 by: Greg Ewing - Sun, 19 Sep 2021 22:53 UTC

> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janburse@fastmail.fm> wrote:
>>
>> On the other hand if I would use the trigger
>> from Python, I possibly would need a double linked
>> list, to remove an element.

Here's another idea: Put weak references in the trail, but
don't bother with the scanning -- just skip over dead ones
during backtracking.

Seems to me you would be doing about the same amount of
work either way, just doing it at different times.

--
Greg

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si9akc$pov$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Mon, 20 Sep 2021 08:44:27 +0200
Message-ID: <si9akc$pov$1@solani.org>
References: <sfb25a$3a5$1@solani.org> <shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com>
<58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com>
<mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.752.1632076433.4164.python-list@python.org>
<iqptbaFsdr7U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 20 Sep 2021 06:44:28 -0000 (UTC)
Injection-Info: solani.org;
logging-data="26399"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
Cancel-Lock: sha1:RR8UWvdwctayXyXioH+dY5jWjTM=
In-Reply-To: <iqptbaFsdr7U1@mid.individual.net>
X-User-ID: eJwNysEBwCAIA8CVxJCg41jA/Ueo7ztCpgwX5by8xWXC0Rm75mfNic2+GNXxWFjL+WWkR2DqBVfX8ffN0PkDQkMVCA==
 by: Mostowski Collapse - Mon, 20 Sep 2021 06:44 UTC

This strategy works if you use failure driven loops.
It doesn't work you program recursive loops that go
on forever. Like Erlang processes.

foo(X) :-
bar(X,Y), foo(Y).

Typically Y is a fresh variable. A good Prolog system
with good Garbage Collection can run such a process
for days and months.

If you don't clean up the trail, you exhaust the
memory after a few minutes or seconds.

Greg Ewing schrieb:
>> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse
>> <janburse@fastmail.fm> wrote:
>>>
>>> On the other hand if I would use the trigger
>>> from Python, I possibly would need a double linked
>>> list, to remove an element.
>
> Here's another idea: Put weak references in the trail, but
> don't bother with the scanning -- just skip over dead ones
> during backtracking.
>
> Seems to me you would be doing about the same amount of
> work either way, just doing it at different times.
>

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<bacff1e0-d8db-447f-b1e2-163ede7da7b3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a37:746:: with SMTP id 67mr15283615qkh.465.1632132279252;
Mon, 20 Sep 2021 03:04:39 -0700 (PDT)
X-Received: by 2002:a37:a155:: with SMTP id k82mr9297719qke.349.1632132279078;
Mon, 20 Sep 2021 03:04:39 -0700 (PDT)
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.python
Date: Mon, 20 Sep 2021 03:04:38 -0700 (PDT)
In-Reply-To: <si9akc$pov$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sfb25a$3a5$1@solani.org> <shtjcb$v8r$6@gioia.aioe.org>
<7232cc7f-52d3-4af8-99c2-d952752cdf09n@googlegroups.com> <58398d5e-6b73-4a50-b52b-0e943bc543f4n@googlegroups.com>
<CAPTjJmoc6qw3kh4U8x9=_x8mEjDvPbLHs5UxL06qU__AsL26mw@mail.gmail.com>
<924df9eb-fb4f-4773-b81c-23e7209368ean@googlegroups.com> <mailman.729.1631743354.4164.python-list@python.org>
<6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com> <CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net> <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.752.1632076433.4164.python-list@python.org> <iqptbaFsdr7U1@mid.individual.net>
<si9akc$pov$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bacff1e0-d8db-447f-b1e2-163ede7da7b3n@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 20 Sep 2021 10:04:39 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 74
 by: Mostowski Collapse - Mon, 20 Sep 2021 10:04 UTC

But I dont see any utility in investing too much time with
the Prolog garbage collection of Dogelog runtime. It is
only a small share of the execution time:

Mostowski Collapse schrieb am Freitag, 17. September 2021 um 10:58:57 UTC+2:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % Standard Python Version, Warm Run
> % ?- time(fibo(23,X)).
> % % Wall 3865 ms, gc 94 ms, 71991 lips
> % X = 46368.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % GraalVM Python Version, Warm Warm Run
> % ?- time(fibo(23,X)).
> % % Wall 695 ms, gc 14 ms, 400356 lips
> % X = 46368.
>
> The "gc" timing measures Prolog garbage
> collection. So you get the following percentage
> of time spent in Prolog garbage collection:
>
> Standard Python: 94 / 3865 = 2.4%
>
> GraalVM Python: 14 / 695 = 2.0%

If you spare these 2-3% it will not speed-up Dogelog runtime.
The Prolog garbage collection is there to allow Erlang
processes. And its also there to allow more Prolog search

without exhausting the memory. But it cost you only 2-3%
judging from the Fibonnacci Numbers example. Need to
check with other examples whether its higher.

But since the ratio between Garbage and non-Garbage is
usually high, and non-Garbage is easily identified, and
the Garbage is also easily removed, the time will

possibly not exceed much more than the same 2-3% for
other examples. So in conclusion I am least worried
about the Prolog garbage collection. You guys are only

worried because its something new. But its nothing that
does any harm and costs a lot, it only does good and
is very cheap in terms of extra runtime effort.

Mostowski Collapse schrieb am Montag, 20. September 2021 um 08:44:49 UTC+2:
> This strategy works if you use failure driven loops.
> It doesn't work you program recursive loops that go
> on forever. Like Erlang processes.
>
> foo(X) :-
> bar(X,Y), foo(Y).
>
> Typically Y is a fresh variable. A good Prolog system
> with good Garbage Collection can run such a process
> for days and months.
>
> If you don't clean up the trail, you exhaust the
> memory after a few minutes or seconds.
>
> Greg Ewing schrieb:
> >> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse
> >> <janb...@fastmail.fm> wrote:
> >>>
> >>> On the other hand if I would use the trigger
> >>> from Python, I possibly would need a double linked
> >>> list, to remove an element.
> >
> > Here's another idea: Put weak references in the trail, but
> > don't bother with the scanning -- just skip over dead ones
> > during backtracking.
> >
> > Seems to me you would be doing about the same amount of
> > work either way, just doing it at different times.
> >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<mailman.753.1632138579.4164.python-list@python.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Mon, 20 Sep 2021 13:49:31 +0200
Lines: 75
Message-ID: <mailman.753.1632138579.4164.python-list@python.org>
References: <6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org>
<si07i1$ds$1@solani.org> <iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<YUh1S59dbFZ3d3IM@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="Wel0+FkRkXXtSTQ9"
X-Trace: news.uni-berlin.de MVBB6E9z8getVgz6eYXYwg5V8hU9byclNvRyts6XOf1w==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; 'angelico': 0.09; 'content-
type:application/pgp-signature': 0.09; 'enough.': 0.09;
'filename:fname piece:asc': 0.09; 'filename:fname
piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
'overhead': 0.09; '"creative': 0.16; '"don\'t': 0.16; '__/': 0.16;
'builtin': 0.16; 'challenge!"': 0.16; 'compiled': 0.16;
'executed': 0.16; 'from:addr:hjp-python': 0.16;
'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16;
'hjp@hjp.at': 0.16; 'holzer': 0.16; 'interpreter': 0.16;
'objects.': 0.16; 'reality.': 0.16; 'stross,': 0.16;
'subject:ANN': 0.16; 'things,': 0.16; 'url-ip:212.17.106.137/32':
0.16; 'url-ip:212.17.106/24': 0.16; 'url-ip:212.17/16': 0.16;
'url:hjp': 0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'python': 0.16;
'uses': 0.19; 'to:addr:python-list': 0.20; 'language': 0.21;
'machine': 0.22; 'code': 0.23; 'list,': 0.24; 'python,': 0.25;
'space': 0.26; 'creating': 0.27; 'chris': 0.28; 'sense': 0.28;
'think': 0.32; 'question': 0.32; 'concept': 0.32; 'sep': 0.32;
'but': 0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'mon,':
0.36; 'possibly': 0.36; 'way': 0.38; 'put': 0.38; 'least': 0.39;
'single': 0.39; 'enough': 0.39; 'list': 0.39; 'use': 0.39;
'double': 0.40; 'hand': 0.40; 'want': 0.40; 'try': 0.40; 'best':
0.61; 'method': 0.61; 'stay': 0.61; 'point.': 0.62;
'received:212': 0.62; 'clear': 0.64; 'your': 0.64; 'his': 0.65;
'top': 0.65; 'well': 0.65; 'less': 0.65; 'let': 0.66;
'received:userid': 0.66; '20,': 0.67; 'nearly': 0.67; 'that,':
0.67; 'know.': 0.68; 'url-ip:212/8': 0.69; '2021': 0.71; 'offer':
0.71; 'subject:2021': 0.76; 'calls.': 0.84; 'fraction': 0.84;
'received:at': 0.84; 'collapse': 0.91
Content-Disposition: inline
In-Reply-To: <CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <YUh1S59dbFZ3d3IM@hjp.at>
X-Mailman-Original-References: <6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org>
<si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
 by: Peter J. Holzer - Mon, 20 Sep 2021 11:49 UTC
Attachments: signature.asc (application/pgp-signature)

On 2021-09-20 04:33:39 +1000, Chris Angelico wrote:
> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janburse@fastmail.fm> wrote:
> > Question to Chris Angelico: If I stay with my
> > sweep_trail(), which is the periodically scanning,
> > I can use a single linked list.
> >
> > On the other hand if I would use the trigger
> > from Python, I possibly would need a double linked
> > list, to remove an element.
> >
> > Chris Angelico, is there a third option, that I have
> > overlooked? Single linked list uses less space
> > than double linked list, this why I go with scan.
> >
>
> I don't know. I don't understand your code well enough to offer advice
> like that, because *your code is too complicated* and not nearly clear
> enough.
>
> But however it is that you're doing things, the best way is almost
> always to directly refer to objects. Don't fiddle around with creating
> your own concept of a doubly-linked list and a set of objects; just
> refer directly to the objects.

And almost certainly: Just use the builtin list type if you need a list.
Don't build one yourself.

> Let Python be Python, don't try to build your own language on top of
> it.

Well, he's writing a Prolog interpreter, so building his own language on
top of Python is sort of the point. I think a better way to put it is
"Don't try to write Python as if it was C". A C operation may be
compiled to a single machine instruction which is executed in a fraction
of a nanosecond. A Python instruction (in CPython) always includes at
least the interpreter overhead and often several method lookups and method
calls. You want to amortize that overhead over as much work as possible.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<ccdfa071-fbdf-4720-87fb-d0665b59d1c4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a0c:f3c6:: with SMTP id f6mr8314588qvm.33.1632139735899;
Mon, 20 Sep 2021 05:08:55 -0700 (PDT)
X-Received: by 2002:a37:a143:: with SMTP id k64mr5258062qke.402.1632139735709;
Mon, 20 Sep 2021 05:08:55 -0700 (PDT)
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.python
Date: Mon, 20 Sep 2021 05:08:55 -0700 (PDT)
In-Reply-To: <mailman.753.1632138579.4164.python-list@python.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net> <fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org> <si6tl1$csn$1@solani.org>
<YUh1S59dbFZ3d3IM@hjp.at> <CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.753.1632138579.4164.python-list@python.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ccdfa071-fbdf-4720-87fb-d0665b59d1c4n@googlegroups.com>
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
From: burse...@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 20 Sep 2021 12:08:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 109
 by: Mostowski Collapse - Mon, 20 Sep 2021 12:08 UTC

I read the following, and you should also know:

> Python's [] is implemented as an array, not a linked list.
> Although resizing is O(n), appending to it is amortized O(1),
> because resizes happen very rarely.
https://stackoverflow.com/a/5932364/502187

The list type doesn't have an O(1) operation to remove
an element during sweep. The list type, not like its name
would suggest, in Python is an array.

These arrays are not so expensive when you append()
an element. Because they are allocated with some excess
capacity. And they grow exponentially.

So amortisized you can append() a lot of elements to
a Python list, which is an array. But you cannot poke so
cheaply holes into it. So if you have this scenario:

Before:
- [ A1, .., An , B, C1, .., Cm ]

After:
- [ A1, .., An , C1, .., Cm ]

You have to copy C1,..,Cm one position down. On the other
hand, when scanning the single list, removing the
element is just pointer swizzling.

The code is here, the positive if-then-else branch keeps
the element, the negative if-then-else branch drops the
element. Thats quite standard algorithm for linked lists:

/* pointer swizzling */
while temp is not None:
term = temp
temp = term.tail
if (term.flags & MASK_VAR_MARK) != 0:
term.flags &= ~MASK_VAR_MARK
if back is not None:
back.tail = term
else:
trail = term
back = term
else:
term.instantiated = NotImplemented
term.tail = None
count -= 1

https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/drawer/machine.py#L163

There is nothing wrong with implementing a single list
in Python. Only you never saw that one maybe. If you would
indeed use Python lists which are arrays, you would

maybe get a much slower sweep_trail() and this would
be seen. But currently its not seen. It happens that 1000000
of elements are sweeped, if you would do this with copy

inside a Python list which are arrays, it would get much
more expensive, and the extremly cheap Prolog garbage
collection, as it stands now, wouldn't be that cheap anymore.

You can try yourself. My sweep_trail() needs frequent resize,
which would be O(n) each, so that sweep_trail becomes O(n^2).
Which the current implementation its only O(n).

Peter J. Holzer schrieb am Montag, 20. September 2021 um 13:49:49 UTC+2:
> On 2021-09-20 04:33:39 +1000, Chris Angelico wrote:
> > On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janb...@fastmail.fm> wrote:
> > > Question to Chris Angelico: If I stay with my
> > > sweep_trail(), which is the periodically scanning,
> > > I can use a single linked list.
> > >
> > > On the other hand if I would use the trigger
> > > from Python, I possibly would need a double linked
> > > list, to remove an element.
> > >
> > > Chris Angelico, is there a third option, that I have
> > > overlooked? Single linked list uses less space
> > > than double linked list, this why I go with scan.
> > >
> >
> > I don't know. I don't understand your code well enough to offer advice
> > like that, because *your code is too complicated* and not nearly clear
> > enough.
> >
> > But however it is that you're doing things, the best way is almost
> > always to directly refer to objects. Don't fiddle around with creating
> > your own concept of a doubly-linked list and a set of objects; just
> > refer directly to the objects.
> And almost certainly: Just use the builtin list type if you need a list.
> Don't build one yourself.
> > Let Python be Python, don't try to build your own language on top of
> > it.
> Well, he's writing a Prolog interpreter, so building his own language on
> top of Python is sort of the point. I think a better way to put it is
> "Don't try to write Python as if it was C". A C operation may be
> compiled to a single machine instruction which is executed in a fraction
> of a nanosecond. A Python instruction (in CPython) always includes at
> least the interpreter overhead and often several method lookups and method
> calls. You want to amortize that overhead over as much work as possible.
>
> hp
>
> --
> _ | Peter J. Holzer | Story must make more sense than reality.
> |_|_) | |
> | | | h...@hjp.at | -- Charles Stross, "Creative writing
> __/ | http://www.hjp.at/ | challenge!"

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si9u35$v9u$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Mon, 20 Sep 2021 14:16:37 +0200
Message-ID: <si9u35$v9u$1@solani.org>
References: <6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org> <YUh1S59dbFZ3d3IM@hjp.at>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.753.1632138579.4164.python-list@python.org>
<ccdfa071-fbdf-4720-87fb-d0665b59d1c4n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 20 Sep 2021 12:16:37 -0000 (UTC)
Injection-Info: solani.org;
logging-data="32062"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.9
In-Reply-To: <ccdfa071-fbdf-4720-87fb-d0665b59d1c4n@googlegroups.com>
X-User-ID: eJwFwYEBwCAIA7CXmJZazgGU/09Y4psf+4BO+Pj0isz1RlJNi60rMlCXfcMf2z9Gauy1DFi9kSVzGEanfmzfFbM=
Cancel-Lock: sha1:CqhK4p0pqE1YfG0t/BRVbrQ6y+c=
 by: Mostowski Collapse - Mon, 20 Sep 2021 12:16 UTC

What would be maybe possible, is to
scan the trail from the other side, and
use a first pass to determine the new

size, and use a second pass to fill a new
array with the remaining elments. This would
be two times O(n), so it would be linear

and not quadratic O(n^2) as when you scan
from the top and poke holes. But then something
else doesn't work so easily. Namely:

def adjust_mark(temp):
while temp is not None:
if (temp.flags & MASK_VAR_MARK) != 0:
return temp
else:
temp = temp.tail
return temp

https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/drawer/machine.py#L151

This is needed to adjust the choice points.
If you have an array instead of a linked
listed as I have now, you would need

to adjust array indexes instead pointers
into linked list elements. I havent come
up with an array solution yet for the trail,

since I dont see any utility in investing too
much time with the Prolog garbage collection of
Dogelog runtime. It is only a small share

of the execution time:

Mostowski Collapse schrieb am Freitag, 17. September 2021 um 10:58:57 UTC+2:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % Standard Python Version, Warm Run
> % ?- time(fibo(23,X)).
> % % Wall 3865 ms, gc 94 ms, 71991 lips
> % X = 46368.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % GraalVM Python Version, Warm Warm Run
> % ?- time(fibo(23,X)).
> % % Wall 695 ms, gc 14 ms, 400356 lips
> % X = 46368.

Mostowski Collapse wrote:
> I read the following, and you should also know:
>
>> Python's [] is implemented as an array, not a linked list.
>> Although resizing is O(n), appending to it is amortized O(1),
>> because resizes happen very rarely.
> https://stackoverflow.com/a/5932364/502187
>
> The list type doesn't have an O(1) operation to remove
> an element during sweep. The list type, not like its name
> would suggest, in Python is an array.
>
> These arrays are not so expensive when you append()
> an element. Because they are allocated with some excess
> capacity. And they grow exponentially.
>
> So amortisized you can append() a lot of elements to
> a Python list, which is an array. But you cannot poke so
> cheaply holes into it. So if you have this scenario:
>
> Before:
> - [ A1, .., An , B, C1, .., Cm ]
>
> After:
> - [ A1, .., An , C1, .., Cm ]
>
> You have to copy C1,..,Cm one position down. On the other
> hand, when scanning the single list, removing the
> element is just pointer swizzling.
>
> The code is here, the positive if-then-else branch keeps
> the element, the negative if-then-else branch drops the
> element. Thats quite standard algorithm for linked lists:
>
> /* pointer swizzling */
> while temp is not None:
> term = temp
> temp = term.tail
> if (term.flags & MASK_VAR_MARK) != 0:
> term.flags &= ~MASK_VAR_MARK
> if back is not None:
> back.tail = term
> else:
> trail = term
> back = term
> else:
> term.instantiated = NotImplemented
> term.tail = None
> count -= 1
>
> https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/drawer/machine.py#L163
>
> There is nothing wrong with implementing a single list
> in Python. Only you never saw that one maybe. If you would
> indeed use Python lists which are arrays, you would
>
> maybe get a much slower sweep_trail() and this would
> be seen. But currently its not seen. It happens that 1000000
> of elements are sweeped, if you would do this with copy
>
> inside a Python list which are arrays, it would get much
> more expensive, and the extremly cheap Prolog garbage
> collection, as it stands now, wouldn't be that cheap anymore.
>
> You can try yourself. My sweep_trail() needs frequent resize,
> which would be O(n) each, so that sweep_trail becomes O(n^2).
> Which the current implementation its only O(n).
>
> Peter J. Holzer schrieb am Montag, 20. September 2021 um 13:49:49 UTC+2:
>> On 2021-09-20 04:33:39 +1000, Chris Angelico wrote:
>>> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse <janb...@fastmail.fm> wrote:
>>>> Question to Chris Angelico: If I stay with my
>>>> sweep_trail(), which is the periodically scanning,
>>>> I can use a single linked list.
>>>>
>>>> On the other hand if I would use the trigger
>>>> from Python, I possibly would need a double linked
>>>> list, to remove an element.
>>>>
>>>> Chris Angelico, is there a third option, that I have
>>>> overlooked? Single linked list uses less space
>>>> than double linked list, this why I go with scan.
>>>>
>>>
>>> I don't know. I don't understand your code well enough to offer advice
>>> like that, because *your code is too complicated* and not nearly clear
>>> enough.
>>>
>>> But however it is that you're doing things, the best way is almost
>>> always to directly refer to objects. Don't fiddle around with creating
>>> your own concept of a doubly-linked list and a set of objects; just
>>> refer directly to the objects.
>> And almost certainly: Just use the builtin list type if you need a list.
>> Don't build one yourself.
>>> Let Python be Python, don't try to build your own language on top of
>>> it.
>> Well, he's writing a Prolog interpreter, so building his own language on
>> top of Python is sort of the point. I think a better way to put it is
>> "Don't try to write Python as if it was C". A C operation may be
>> compiled to a single machine instruction which is executed in a fraction
>> of a nanosecond. A Python instruction (in CPython) always includes at
>> least the interpreter overhead and often several method lookups and method
>> calls. You want to amortize that overhead over as much work as possible.
>>
>> hp
>>
>> --
>> _ | Peter J. Holzer | Story must make more sense than reality.
>> |_|_) | |
>> | | | h...@hjp.at | -- Charles Stross, "Creative writing
>> __/ | http://www.hjp.at/ | challenge!"

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

<si9ud2$vcd$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.python
Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)
Date: Mon, 20 Sep 2021 14:21:54 +0200
Message-ID: <si9ud2$vcd$1@solani.org>
References: <6a2ecba4-0558-4784-a9ae-edefca830351n@googlegroups.com>
<CAPTjJmrmdK48mhFTOkKKOh9Y=5oRJErE1L4SqfRmQkXJ91Z1cg@mail.gmail.com>
<mailman.731.1631813366.4164.python-list@python.org> <si07i1$ds$1@solani.org>
<iql5tuFjaqU1@mid.individual.net>
<fc2ede48-9232-4720-97c2-cdd67d310734n@googlegroups.com>
<CAPTjJmrt=CPA3eGzgq=ez7Z_5rab2z8-J907WXQZHJAp+Zcbvg@mail.gmail.com>
<mailman.743.1632016663.4164.python-list@python.org>
<si6tl1$csn$1@solani.org> <YUh1S59dbFZ3d3IM@hjp.at>
<CAPTjJmrG1XcrvU+HhfwS0sCNnvLXq4oQFY29acw6vKir8UnSOQ@mail.gmail.com>
<mailman.753.1632138579.4164.python-list@python.org>
<ccdfa071-fbdf-4720-87fb-d0665b59d1c4n@googlegroups.com>
<si9u35$v9u$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 20 Sep 2021 12:21:54 -0000 (UTC)
Injection-Info: solani.org;
logging-data="32141"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.9
Cancel-Lock: sha1:VkWN6AKc2toprQwt+R5Hw9SS5K0=
In-Reply-To: <si9u35$v9u$1@solani.org>
X-User-ID: eJwFwQcBwEAIBDBLT+EYcpj+JTQBK2mbKFRwuOcoPGpIxO1Wb85c3cgyfelBtjM1fpYuLNrKJVmxbyFnP388FsA=
 by: Mostowski Collapse - Mon, 20 Sep 2021 12:21 UTC

In general the algorithm I am using is from
a paper by Matts Carlson from SICStus Prolog.
Its this paper here:

Garbage Collection for Prolog Based on WAM
January 1986
Karen Appleby, Mats Carlsson, Seif Haridi, Dan Sahlin
https://www.researchgate.net/publication/279463524

But since you guys are so facinated with
the Prolog garbage collection aspect, which
is not the locus where you can do a lot

of optimizations, feel free to investigate
and come up with a solution. It will not
change the performance of Dogelog runtime,

but it could be an academic experiment
neverthless. There is nothing wrong with the
simgle linked list as it stands, since

it has O(n) sweep_trail(). It uses a litte
more storage than an array would do.

Mostowski Collapse wrote:
> What would be maybe possible, is to
> scan the trail from the other side, and
> use a first pass to determine the new
>
> size, and use a second pass to fill a new
> array with the remaining elments. This would
> be two times O(n), so it would be linear
>
> and not quadratic O(n^2) as when you scan
> from the top and poke holes. But then something
> else doesn't work so easily. Namely:
>
>    def adjust_mark(temp):
>        while temp is not None:
>         if (temp.flags & MASK_VAR_MARK) != 0:
>             return temp
>         else:
>             temp = temp.tail
>     return temp
>
> https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/drawer/machine.py#L151
>
>
> This is needed to adjust the choice points.
> If you have an array instead of a linked
> listed as I have now, you would need
>
> to adjust array indexes instead pointers
> into linked list elements. I havent come
> up with an array solution yet for the trail,
>
> since I dont see any utility in investing too
> much time with the Prolog garbage collection of
> Dogelog runtime. It is only a small share
>
> of the execution time:
>
> Mostowski Collapse schrieb am Freitag, 17. September 2021 um 10:58:57
> UTC+2:
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > % Standard Python Version, Warm Run
> > % ?- time(fibo(23,X)).
> > % % Wall 3865 ms, gc 94 ms, 71991 lips
> > % X = 46368.
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > % GraalVM Python Version, Warm Warm Run
> > % ?- time(fibo(23,X)).
> > % % Wall 695 ms, gc 14 ms, 400356 lips
> > % X = 46368.
>
> Mostowski Collapse wrote:
>> I read the following, and you should also know:
>>
>>> Python's [] is implemented as an array, not a linked list.
>>> Although resizing is O(n), appending to it is amortized O(1),
>>> because resizes happen very rarely.
>> https://stackoverflow.com/a/5932364/502187
>>
>> The list type doesn't have an O(1) operation to remove
>> an element during sweep. The list type, not like its name
>> would suggest, in Python is an array.
>>
>> These arrays are not so expensive when you append()
>> an element. Because they are allocated with some excess
>> capacity. And they grow exponentially.
>>
>> So amortisized you can append() a lot of elements to
>> a Python list, which is an array. But you cannot poke so
>> cheaply holes into it. So if you have this scenario:
>>
>> Before:
>>       - [ A1, .., An , B, C1, .., Cm ]
>>
>> After:
>>       - [ A1, .., An , C1, .., Cm ]
>> You have to copy C1,..,Cm one position down. On the other
>> hand, when scanning the single list, removing the
>> element is just pointer swizzling.
>>
>> The code is here, the positive if-then-else branch keeps
>> the element, the negative if-then-else branch drops the
>> element. Thats quite standard algorithm for linked lists:
>>
>>       /* pointer swizzling */
>>      while temp is not None:
>>          term = temp
>>          temp = term.tail
>>          if (term.flags & MASK_VAR_MARK) != 0:
>>              term.flags &= ~MASK_VAR_MARK
>>              if back is not None:
>>                  back.tail = term
>>              else:
>>                  trail = term
>>              back = term
>>          else:
>>              term.instantiated = NotImplemented
>>              term.tail = None
>>              count -= 1
>>
>> https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/drawer/machine.py#L163
>>
>>
>> There is nothing wrong with implementing a single list
>> in Python. Only you never saw that one maybe. If you would
>> indeed use Python lists which are arrays, you would
>>
>> maybe get a much slower sweep_trail() and this would
>> be seen. But currently its not seen. It happens that 1000000
>> of elements are sweeped, if you would do this with copy
>>
>> inside a Python list which are arrays, it would get much
>> more expensive, and the extremly cheap Prolog garbage
>> collection, as it stands now, wouldn't be that cheap anymore.
>>
>> You can try yourself. My sweep_trail() needs frequent resize,
>> which would be O(n) each, so that sweep_trail becomes O(n^2).
>> Which the current implementation its only O(n).
>>
>> Peter J. Holzer schrieb am Montag, 20. September 2021 um 13:49:49 UTC+2:
>>> On 2021-09-20 04:33:39 +1000, Chris Angelico wrote:
>>>> On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse
>>>> <janb...@fastmail.fm> wrote:
>>>>> Question to Chris Angelico: If I stay with my
>>>>> sweep_trail(), which is the periodically scanning,
>>>>> I can use a single linked list.
>>>>>
>>>>> On the other hand if I would use the trigger
>>>>> from Python, I possibly would need a double linked
>>>>> list, to remove an element.
>>>>>
>>>>> Chris Angelico, is there a third option, that I have
>>>>> overlooked? Single linked list uses less space
>>>>> than double linked list, this why I go with scan.
>>>>>
>>>>
>>>> I don't know. I don't understand your code well enough to offer advice
>>>> like that, because *your code is too complicated* and not nearly clear
>>>> enough.
>>>>
>>>> But however it is that you're doing things, the best way is almost
>>>> always to directly refer to objects. Don't fiddle around with creating
>>>> your own concept of a doubly-linked list and a set of objects; just
>>>> refer directly to the objects.
>>> And almost certainly: Just use the builtin list type if you need a list.
>>> Don't build one yourself.
>>>> Let Python be Python, don't try to build your own language on top of
>>>> it.
>>> Well, he's writing a Prolog interpreter, so building his own language on
>>> top of Python is sort of the point. I think a better way to put it is
>>> "Don't try to write Python as if it was C". A C operation may be
>>> compiled to a single machine instruction which is executed in a fraction
>>> of a nanosecond. A Python instruction (in CPython) always includes at
>>> least the interpreter overhead and often several method lookups and
>>> method
>>> calls. You want to amortize that overhead over as much work as possible.
>>>
>>> hp
>>>
>>> --
>>> _ | Peter J. Holzer | Story must make more sense than reality.
>>> |_|_) | |
>>> | | | h...@hjp.at | -- Charles Stross, "Creative writing
>>> __/ | http://www.hjp.at/ | challenge!"
>


devel / comp.lang.python / Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor