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

2021-09-20 Thread Peter J. Holzer
On 2021-09-20 05:08:55 -0700, Mostowski Collapse wrote: > 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. That's the problem. You think that pointer swizzling is fast because you are used to

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

2021-09-20 Thread Chris Angelico
On Tue, Sep 21, 2021 at 3:58 AM 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. >

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

2021-09-20 Thread Chris Angelico
On Tue, Sep 21, 2021 at 3:51 AM Mostowski Collapse wrote: > > 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

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

2021-09-20 Thread Mostowski Collapse
Now I am expecting somebody telling me I should not program Java style in Python. So I wonder what would have happened if I would tell you I am FORTRAN programmer. Then somebody would tell me I should not program FORTRAN style in Python. Hopefully this makes it evident that this argumentation is

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

2021-09-20 Thread Mostowski Collapse
The sweep_trail() is not an issue. There must be a bottleneck somewhere else in Python. The sweep_trail() respectively the paremt call gc() only takes a very small fraction of the runtime: Check the "gc" timing, the bottleneck is somewhere else? Mostowski Collapse schrieb am Freitag, 17.

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

2021-09-20 Thread Mostowski Collapse
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

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

2021-09-20 Thread Mostowski Collapse
Also I am not a C programmer. The last time I was programming C was 30 years ago. I am mostly a Java programmer the recent years. Dogelog Runtime adopts a lot of implementation details from Jekejeke Prolog which is a Prolog written in Java. The difference betweeen the two is that Jekejeke

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

2021-09-20 Thread Mostowski Collapse
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

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

2021-09-20 Thread Mostowski Collapse
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

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

2021-09-20 Thread Mostowski Collapse
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

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

2021-09-20 Thread Mostowski Collapse
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)

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

2021-09-20 Thread Mostowski Collapse
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:

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

2021-09-20 Thread Mostowski Collapse
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: > %%% > %

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

2021-09-20 Thread Mostowski Collapse
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

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

2021-09-20 Thread Greg Ewing
On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse 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

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

2021-09-20 Thread Chris Angelico
On Mon, Sep 20, 2021 at 9:50 PM Peter J. Holzer wrote: > > 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

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

2021-09-20 Thread Peter J. Holzer
On 2021-09-20 04:33:39 +1000, Chris Angelico wrote: > On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse > 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

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

2021-09-19 Thread Chris Angelico
On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse 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. > > > >

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

2021-09-19 Thread Mostowski Collapse
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

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

2021-09-19 Thread Mostowski Collapse
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

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

2021-09-18 Thread Chris Angelico
On Sun, Sep 19, 2021 at 11:46 AM Mostowski Collapse 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. > >

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

2021-09-18 Thread Greg Ewing
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:

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

2021-09-18 Thread Mostowski Collapse
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

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

2021-09-18 Thread Greg Ewing
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

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

2021-09-18 Thread Greg Ewing
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

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

2021-09-17 Thread Mostowski Collapse
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:

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

2021-09-17 Thread Mostowski Collapse
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

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

2021-09-17 Thread Mostowski Collapse
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

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

2021-09-17 Thread Greg Ewing
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)

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

2021-09-17 Thread Mostowski Collapse
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

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

2021-09-16 Thread Greg Ewing
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

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

2021-09-16 Thread Greg Ewing
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

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

2021-09-16 Thread Chris Angelico
On Fri, Sep 17, 2021 at 7:17 AM Mostowski Collapse 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

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

2021-09-16 Thread Mostowski Collapse
ations from a more primitive language. > -Original Message- > From: Python-list On > Behalf Of Mostowski Collapse > Sent: Thursday, September 16, 2021 3:59 PM > To: pytho...@python.org > Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021) > > Here is a chall

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

2021-09-16 Thread Avi Gross via Python-list
-list On Behalf Of Mostowski Collapse Sent: Thursday, September 16, 2021 3:59 PM To: python-list@python.org Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021) Here is a challenge for Python. Can Python solve Sudoku? Mostowski Collapse wrote: > I am not testing this use-c

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

2021-09-16 Thread Mostowski Collapse
A friend just sent me a Web Sudoku made with Dogelog Runtime https://gist.github.com/jburse/c85297e97091caf22d306dd8c8be12fe#gistcomment-3895696 LoL Mostowski Collapse schrieb am Donnerstag, 16. September 2021 um 21:59:05 UTC+2: > Here is a challenge for Python. > Can Python solve Sudoku? > >

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

2021-09-16 Thread Mostowski Collapse
Here is a challenge for Python. Can Python solve Sudoku? Mostowski Collapse wrote: I am not testing this use-case. But a related use-case might highlight why speed did never hurt anybody. Lets say you program a flying drone with Python, and the measurement is from the drone sensor and

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

2021-09-16 Thread Mostowski Collapse
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, or maybe some Weak Pointer magic can do it? The use case is

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

2021-09-16 Thread Chris Angelico
On Fri, Sep 17, 2021 at 3:20 AM Mostowski Collapse wrote: > > Compound is not used for boxing. Integers and floats > are represented directly. Also integers are not mapped to > floats. But maybe compound could be a little flattened, > "Boxing" in this case isn't about ints and floats, since

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

2021-09-16 Thread Mostowski Collapse
Compound is not used for boxing. Integers and floats are represented directly. Also integers are not mapped to floats. But maybe compound could be a little flattened, like using directly an array. But then you cannot assure anymore "clean, simple, readable code". For example now I have clean,

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

2021-09-15 Thread Chris Angelico
On Thu, Sep 16, 2021 at 7:59 AM Mostowski Collapse wrote: > > BTW: I could already make it faster, by not repeatedly > accessing .arg anymore. It went down from ca.: > > 171'000 ms > > To this here: > > 140'000 ms > > But only in the cold run. In the warm run it went back > to 171'000 ms.

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

2021-09-15 Thread Mostowski Collapse
Thank you for the suggestion. The test harness is invoked as follows. So it does already do time/1, thats also how I did the comparison Standard Python and GraalVM Python, a file dogelog.py: import sys # sys.path.append("\jekrun_bench\core\harness2\libpy")

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

2021-09-15 Thread Mostowski Collapse
BTW: I could already make it faster, by not repeatedly accessing .arg anymore. It went down from ca.: 171'000 ms To this here: 140'000 ms But only in the cold run. In the warm run it went back to 171'000 ms. Possibly when my code is faster, it will create objects more faster, and kill the

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

2021-09-15 Thread Mostowski Collapse
Ok you suggested: >>>items = [1,2,3,4,5,6,7,8,9,0] >>>for item in items[:-1]: >>> print(item) 1 2 3 4 5 6 7 8 9 Does this also work for length = 1? Ok let me try: >>> foo = ["a","b","c"] >>> for x in foo[:-1]: ... print(x) ... a b >>> foo = ["a"] >>> for x in foo[:-1]: ... print(x)

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

2021-09-15 Thread DFS
On 9/15/2021 5:10 PM, Mostowski Collapse wrote: And how do you only iterate over n-1 elements? I don't need a loop over all elements. With array slicing? Someting like: for item in items[0:len(items)-2]: ___print(item) Or with negative slicing indexes? Problem is my length can be equal to

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

2021-09-15 Thread Mostowski Collapse
And how do you only iterate over n-1 elements? I don't need a loop over all elements. With array slicing? Someting like: for item in items[0:len(items)-2]: ___print(item) Or with negative slicing indexes? Problem is my length can be equal to one. And when I have length equal to one, the

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

2021-09-15 Thread alister via Python-list
On Wed, 15 Sep 2021 11:56:47 -0700, 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] > No this construct is a common error in new

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

2021-09-15 Thread DFS
On 9/15/2021 12:23 PM, Mostowski Collapse wrote: I really wonder why my Python implementation is a factor 40 slower than my JavaScript implementation. Structurally its the same code. You can check yourself: Python Version:

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

2021-09-15 Thread alister via Python-list
On Wed, 15 Sep 2021 11:48:18 -0700, Mostowski Collapse wrote: > And how do you iterate over the first n-1 elements of a list with n > elements? This is what my code does: > > i = 0 while i < len(term.args) - 1: > mark_term(term.args[i]) > i += 1 term = term.args[i] > > You can try

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

2021-09-15 Thread Mostowski Collapse
But the end-result is still very weak: % Wall 33810 ms, gc 980 ms, 284108 lips This is below 1 million LIPS. The JavaScript version of Dogelog does currently around 2 million LIPS. And SWI-Prolog can do around 20 million LIPS. Mostowski Collapse schrieb am Mittwoch, 15. September 2021 um

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

2021-09-15 Thread Mostowski Collapse
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] Mostowski Collapse schrieb am Mittwoch, 15. September 2021 um 20:48:31 UTC+2: > And how do you iterate over the first

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

2021-09-15 Thread Chris Angelico
On Thu, Sep 16, 2021 at 5:15 AM Mostowski Collapse wrote: > > If you find a "wonky" spot, I can replace it by "non-wonky" > code. I noticed some differences between Python Dicts > and JavaScript objects. Python tends to throw more exceptions. > > So in Python I now do the following: > >peek =

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

2021-09-15 Thread Mostowski Collapse
There is a Python 3.8 compatible version here: https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/machine2.py I have replaced match by if-then-else. So as to be able to test with GraalVM. GraalVM is still faster despite using if-then-else. But GraalVM needs some time to JIT the

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

2021-09-15 Thread Mostowski Collapse
And how do you iterate over the first n-1 elements of a list with n elements? This is what my code does: i = 0 while i < len(term.args) - 1: mark_term(term.args[i]) i += 1 term = term.args[i] You can try yourself: % python3 >>> foo = ["a", "b", "c"] >>> i = 0 >>> while i < len(foo) -

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

2021-09-15 Thread alister via Python-list
On Wed, 15 Sep 2021 18:40:52 +, alister wrote: > On Wed, 15 Sep 2021 11:31:48 -0700, Mostowski Collapse wrote: > >> There is a further problem with this: >> >>> for i,term in enumerate(term.args): >>> mark_term(term.args[i]) >> >> It should read: >> >> for i,help in

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

2021-09-15 Thread alister via Python-list
On Wed, 15 Sep 2021 11:31:48 -0700, Mostowski Collapse wrote: > There is a further problem with this: > >> for i,term in enumerate(term.args): >> mark_term(term.args[i]) > > It should read: > > for i,help in enumerate(term.args): > mark_term(help) > > But then i isn't need. even

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

2021-09-15 Thread Mostowski Collapse
There is a further problem with this: > for i,term in enumerate(term.args): > mark_term(term.args[i]) It should read: for i,help in enumerate(term.args): mark_term(help) But then i isn't need. Mostowski Collapse schrieb am Mittwoch, 15. September 2021 um 20:22:50 UTC+2: > Do you

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

2021-09-15 Thread Mostowski Collapse
Well I would be more than happy if an experienced programmer can fine tune my code. My programming experience in Python is only 4 weeks. Mostowski Collapse schrieb am Dienstag, 14. September 2021 um 14:56:35 UTC+2: > The test harness, test cases and individual > results for all test cases are

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

2021-09-15 Thread Mostowski Collapse
Do you mean, replace this: i = 0 while i < len(term.args) - 1: mark_term(term.args[i]) i += 1 term = term.args[i] By this: for i,term in enumerate(term.args): mark_term(term.args[i]) This wouldn't be correct anymore. The recursive call is only for the arguments except for the

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

2021-09-15 Thread alister via Python-list
On Wed, 15 Sep 2021 18:23:10 +0200, Mostowski Collapse wrote: > I really wonder why my Python implementation is a factor 40 slower than > my JavaScript implementation. > Structurally its the same code. > > You can check yourself: > > Python Version: >

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

2021-09-15 Thread Mostowski Collapse
If you find a "wonky" spot, I can replace it by "non-wonky" code. I noticed some differences between Python Dicts and JavaScript objects. Python tends to throw more exceptions. So in Python I now do the following: peek = kb.get(functor, NotImplemented) if peek is not NotImplemented:

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

2021-09-15 Thread alister via Python-list
On Thu, 16 Sep 2021 03:26:39 +1000, Chris Angelico wrote: > On Thu, Sep 16, 2021 at 3:17 AM Mostowski Collapse > wrote: >> >> I really wonder why my Python implementation is a factor 40 slower than >> my JavaScript implementation. >> Structurally its the same code. >> >> > Very hard to know.

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

2021-09-15 Thread Chris Angelico
On Thu, Sep 16, 2021 at 3:17 AM Mostowski Collapse wrote: > > I really wonder why my Python implementation > is a factor 40 slower than my JavaScript implementation. > Structurally its the same code. > Very hard to know. Your code is detailed and complicated. Do they produce identical results?

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

2021-09-15 Thread Mostowski Collapse
I really wonder why my Python implementation is a factor 40 slower than my JavaScript implementation. Structurally its the same code. You can check yourself: Python Version: https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/machine.py JavaScript Version:

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

2021-09-15 Thread Mostowski Collapse
Oops "speed did never hurt anybody". Don't be evil, I am talking about unarmed drones. See also: Drone Programming With Python Course https://www.youtube.com/watch?v=LmEcyQnfpDA Mostowski Collapse schrieb: I am not testing this use-case. But a related use-case might highlight why speed did

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

2021-09-15 Thread Mostowski Collapse
I am not testing this use-case. But a related use-case might highlight why speed did never hurt anybody. Lets say you program a flying drone with Python, and the measurement is from the drone sensor and communication systems. Lets say you are using the idle time between measurements for some

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

2021-09-14 Thread Schachner, Joseph
with us. --- Joseph S. Teledyne Confidential; Commercially Sensitive Business Data -Original Message- From: Mostowski Collapse Sent: Tuesday, September 14, 2021 8:56 AM To: python-list@python.org Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021) I am testing a Prolog

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

2021-09-14 Thread Mostowski Collapse
But even when using GraalVM Python, the execution is still slow. Much slower then the same Prolog interpreter written in JavaScript. For JavaScript node.exe I get much better results. I get these results comparing to a few other new Prolog systems as well: TestDogelog Scryer

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

2021-09-14 Thread Mostowski Collapse
I am testing a Prolog interpreter written in Python. So fibonacci number routine is written in Prolog and I am running the fibonnaci number routine inside the Prolog interpreter that is written in Python. The factor 6x times faster of GraalVM can be reproduced also for other Prolog programs

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

2021-09-13 Thread Terry Reedy
On 9/13/2021 8:46 AM, Mostowski Collapse wrote: The Standard Python version of Dogelog runtime is annoyingly slow. So we gave it a try with andother Python, and it was 6x times faster. We could test GraalVM. We worked around the missing match in Python 3.8 by replacing it with if-then-else.

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

2021-09-13 Thread Mostowski Collapse
The Standard Python version of Dogelog runtime is annoyingly slow. So we gave it a try with andother Python, and it was 6x times faster. We could test GraalVM. We worked around the missing match in Python 3.8 by replacing it with if-then-else. Performance is a little better, we find: /*

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

2021-09-02 Thread Mostowski Collapse
More best kept secrets of Prolog: Pattern Matching Everybody loves pattern matching. Languages like Python, release 3.10, even provide it now. There is now a match/case statement in Python. But Prolog users will scratch their head. Will my if-then-else be as fast as a imperative switch jump

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

2021-08-26 Thread Mostowski Collapse
Having fun with a new attended query answerer for the Dogelog runtime. It can be bottled into a single Python file, no server roundtrip, just ISO core Prolog in one Python file, requires Python 3.10: >python.exe toplevel.py Dogelog Runtime, Prolog to the Moon, 0.9.3 (c) 1985-2021, XLOG

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

2021-08-23 Thread Mostowski Collapse
The world is getting ridiculous. termux seems to not anymore be supported by Google Play because of some Android 10 issues? On the other hand there is this gem: TI 84 Plus CE Python Edition Unboxing https://www.youtube.com/watch?v=LVxP_Fki8Fc LoL Mostowski Collapse schrieb: Yesterday we went

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

2021-08-20 Thread Mostowski Collapse
We = Me and my cat named socrates The cat is a very good programmer: def meow(): print("meow meow, Prolog is not only SWI-Prolog") Julio Di Egidio schrieb: On Sunday, 15 August 2021 at 14:43:42 UTC+2, Mostowski Collapse wrote: Yesterday we went into a little programming binge Who is

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

2021-08-19 Thread Mostowski Collapse
Thats a factor 37.8 faster! I tested the a variant of the Albufeira instructions Prolog VM aka ZIP, which was also the inspiration for SWI-Prolog. Open Source: The Python Version of the Dogelog Runtime https://github.com/jburse/dogelog-moon/tree/main/devel/runtimepy The Python Test Harness

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

2021-08-19 Thread Mostowski Collapse
Woa! The JavaScript JIT compiler is quite impressive. I now ported Dogelog runtime to Python as well, so that I can compare JavaScript and Python, and tested without clause indexing: between(L,H,L) :- L =< H. between(L,H,X) :- L < H, Y is L+1, between(Y,H,X). setup :- between(1,255,N), M is