Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #14843
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.prolog |
| Subject | Had to Rollback my Jaffar Unification (Was: unify_with_occurs_check/2 might have been fixed) |
| Date | 2025-09-25 01:59 +0200 |
| Message-ID | <10b20kk$1cu8$1@solani.org> (permalink) |
| References | <107t0fi$6bgl$1@solani.org> <10ajo4u$k5kc$1@solani.org> <10b2038$1ce0$1@solani.org> |
Hi, The facinating result was the Jaffar Unification beats Scryer Prolog even on the target JavaScript. Not to speak of the Java target, which also beat it. But I rejected Jaffar Unification, because it temporarily modifies my frozen terms, which might impede some future program sharing across premptive threads. So I rolled back Pointer based Jaffar Unification, and went back to Map Based Union Find. Overall the Map and a slightly bigger stack incures a factor 3x slowdown. So for Java I get now: /* Dogelog Player 2.1.1 for Java */ % ?- bench, bench, bench. % [...] % % Zeit 469 ms, GC 0 ms, Lips 42, Uhr 24.09.2025 20:00 % % Zeit 318 ms, GC 0 ms, Lips 62, Uhr 24.09.2025 20:00 % % Zeit 329 ms, GC 0 ms, Lips 60, Uhr 24.09.2025 20:00 % % Zeit 378 ms, GC 0 ms, Lips 52, Uhr 24.09.2025 20:00 % true. % ?- bench2, bench2, bench2. % [...] % % Zeit 847 ms, GC 0 ms, Lips 23, Uhr 25.09.2025 01:04 % % Zeit 506 ms, GC 0 ms, Lips 39, Uhr 25.09.2025 01:04 % % Zeit 186 ms, GC 0 ms, Lips 118, Uhr 25.09.2025 01:04 % % Zeit 418 ms, GC 0 ms, Lips 35, Uhr 25.09.2025 01:04 % true. In the binary predicates (bench) the factor 3x is pretty much seen. But in the unary predicates (bench2) the factor is much higher , something 10x - 20x. And JavaScript doesn't help. But this might be the price to pay for a "non-intrusive" algorithm. Another name I have for my current take is "non-tainting" algorithms. Should put a closer eye what could be done "non-intrusive", or maybe device an algorithm that is a mixture of "non- intrusive" and "intrucive". Bye Mild Shock schrieb: > Hi, > > Scryer Prologs unify_with_occurs_check/2 might have > been fixed. I can now test the following: > > /* Scryer Prolog 0.9.4-660 */ > > % ?- bench, bench, bench. > % [...] > % % CPU time: 0.148s, 57 inferences > % % CPU time: 0.126s, 57 inferences > % % CPU time: 0.214s, 58 inferences > % % CPU time: 0.213s, 58 inferences > % true. > > % ?- bench2, bench2, bench2. > % [...] > % % CPU time: 0.036s, 58 inferences > % % CPU time: 0.042s, 58 inferences > % % CPU time: 0.018s, 59 inferences > % % CPU time: 0.096s, 56 inferences > % true. > > This was the test case, it includes > unify_with_occurs_check/2: > > hydra(0, _) :- !. > hydra(N, h(X, X)) :- N > 0, N0 is N-1, hydra(N0, X). > > hydra(0, A, A) :- !. > hydra(N, h(X, X), A) :- N > 0, N0 is N-1, hydra(N0, X, A). > > bench :- > hydra(1048576, X), hydra(1048576, Y, Y), > time(X = Y), > time(unify_with_occurs_check(X, Y)), > time(X == Y), > time(compare(_, X, Y)), fail; true. > > bench2 :- > hydra(1048576, X), hydra(1048576, Y, Y), > time(copy_term(X-Y,_)), > time(term_variables(X-Y,_)), > time(\+ ground(X-Y)), > time(acyclic_term(X-Y)), > fail; true. > > Bye > > Mild Shock schrieb: >> Hi, >> >> Since some idiots blocked me on Scryer Prolog issues, >> I raise the issue here. Basically uniy_with_occurs_check/2 >> probably does use a different implementation of unification >> >> than find for (=)/2. Because it doesn't scale, I find: >> >> /* Scryer Prolog */ >> ?- test3(25). >> % CPU time: 0.001s, 57 inferences >> true. >> >> ?- test4(25). >> % CPU time: 2.133s, 57 inferences >> true. >> >> Expectation would be that unify_with_occurs_check/2 >> does just scale like it does in SWI-Prolog. In >> SWI-Prolog I find: >> >> /* SWI-Prolog 9.3.30 */ >> ?- test3(25). >> % -1 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips) >> true. >> >> ?- test4(25). >> % -1 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips) >> true. >> >> The test case was simply a hydra variant. Actually the >> last hydra modification posted by @kuniaki, which I >> am currently ticking along now: >> >> hydra(0, _) :- !. >> hydra(N, h(X, X)):- N>0, N0 is N-1, hydra(N0, X). >> >> hydra(0, A, A) :- !. >> hydra(N, h(X, X), A):- N>0, N0 is N-1, hydra(N0, X, A). >> >> test3(N) :- hydra(N, X), hydra(N, Y, Y), >> time(X = Y). >> >> test4(N) :- hydra(N, X), hydra(N, Y, Y), >> time(unify_with_occurs_check(X, Y)). >> >> But of course there is a cut (!) in the first rules. >> >> Mild Shock schrieb: >>> Hi, >>> >>> WebPL is already outdated I guess. It doesn't >>> show the versions of the other Prolog systems >>> it is using. While I had these results for >>> >>> the primes example in the WebPL playground: >>> >>> /* Trealla Prolog WASM */ >>> (23568.9ms) >>> >>> When I run the example here: >>> >>> https://php.energy/trealla.html >>> >>> I get better results: >>> >>> /* trealla-js 0.27.1 */ >>> >>> ?- time(test). >>> % Time elapsed 9.907s, 11263917 Inferences, 1.137 MLips >>> >>> Bye >> >
Back to comp.lang.prolog | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
WebPL is already outdated Mild Shock <janburse@fastmail.fm> - 2025-08-17 18:37 +0200
Heap/Stack versus WAM resp. ZIP (Was: WebPL is already outdated) Mild Shock <janburse@fastmail.fm> - 2025-08-18 14:52 +0200
Trealla knows Program Sharing (PS) Tricks ? (Was: Heap/Stack versus WAM resp. ZIP) Mild Shock <janburse@fastmail.fm> - 2025-08-18 15:06 +0200
Smarter Partial Strings would use Program Sharing ['$append'/3] (Was: Trealla knows Program Sharing (PS) Tricks ?) Mild Shock <janburse@fastmail.fm> - 2025-08-18 15:42 +0200
Static Shunting is even better [Dogelog Player] (Was: Smarter Partial Strings would use Program Sharing ['$append'/3]) Mild Shock <janburse@fastmail.fm> - 2025-08-18 15:49 +0200
The Artificial Intelligence Flip: Acer Swift Go! (Was: WebPL is already outdated) Mild Shock <janburse@fastmail.fm> - 2025-08-31 23:56 +0200
2025 will be last year we hear of Python (Re: The Artificial Intelligence Flip: Acer Swift Go!) Mild Shock <janburse@fastmail.fm> - 2025-09-01 00:45 +0200
Apertus: With love, from Switzerland [02 Sept 2025] (Re: 2025 will be last year we hear of Python) Mild Shock <janburse@fastmail.fm> - 2025-09-05 00:36 +0100
Don't try this (Was: Apertus: With love, from Switzerland [02 Sept 2025] ) Mild Shock <janburse@fastmail.fm> - 2025-09-05 01:03 +0100
AI means ambracing Non-Linearity (Was: 2025 will be last year we hear of Python) Mild Shock <janburse@fastmail.fm> - 2025-09-19 10:01 +0200
AI soaked PCs: Is there a Copilot+ Prolog? (Was: AI means ambracing Non-Linearity) Mild Shock <janburse@fastmail.fm> - 2025-09-19 10:10 +0200
The morning coffee incident [Prolog Community] (Was: AI soaked PCs: Is there a Copilot+ Prolog?) Mild Shock <janburse@fastmail.fm> - 2025-09-19 14:38 +0200
Root Cause Prediction for Your Brain (Was: The morning coffee incident [Prolog Community]) Mild Shock <janburse@fastmail.fm> - 2025-09-19 18:22 +0200
Please delete my account and all my posts on SWI-Prolog discourse (Re: Root Cause Prediction for Your Brain) Mild Shock <janburse@fastmail.fm> - 2025-09-19 18:38 +0200
I will consult a Lawyer of mine (Was: Please delete my account and all my posts on SWI-Prolog discourse) Mild Shock <janburse@fastmail.fm> - 2025-09-19 18:42 +0200
Scryer Prolog unify_with_occurs_check/2 doesn't scale (Was: WebPL is already outdated) Mild Shock <janburse@fastmail.fm> - 2025-09-19 16:08 +0200
How bad is Rust, can JavaScript beat it? (Was: Scryer Prolog unify_with_occurs_check/2 doesn't scale) Mild Shock <janburse@fastmail.fm> - 2025-09-19 16:18 +0200
unify_with_occurs_check/2 might have been fixed (Was: Scryer Prolog unify_with_occurs_check/2 doesn't scale) Mild Shock <janburse@fastmail.fm> - 2025-09-25 01:50 +0200
Had to Rollback my Jaffar Unification (Was: unify_with_occurs_check/2 might have been fixed) Mild Shock <janburse@fastmail.fm> - 2025-09-25 01:59 +0200
Trealla Prolog might apply "frozeness" to cyclic terms (Was: Had to Rollback my Jaffar Unification) Mild Shock <janburse@fastmail.fm> - 2025-09-25 02:06 +0200
Non-intrusive through "frozen" subcategories (Was: Trealla Prolog might apply "frozeness" to cyclic terms) Mild Shock <janburse@fastmail.fm> - 2025-09-25 02:21 +0200
Scryer Prolog occurs check cannot do hydra (Was: Scryer Prolog unify_with_occurs_check/2 doesn't scale) Mild Shock <janburse@fastmail.fm> - 2025-09-26 12:19 +0200
WebPL and Scryer Prolog are bad examples (Was: WebPL is already outdated) Mild Shock <janburse@fastmail.fm> - 2025-10-13 09:49 +0200
Who will win Shift-Reduce or Tabled DCG? [AI Boom] (Was: WebPL and Scryer Prolog are bad examples) Mild Shock <janburse@fastmail.fm> - 2025-10-13 15:09 +0200
primes.pl mainly tests the Prolog ALU [mod/2 vs rem/2] (Was: WebPL is already outdated) Mild Shock <janburse@fastmail.fm> - 2025-10-15 02:38 +0200
25-30% is insane, Neural Network Branch Prediction? (Was: primes.pl mainly tests the Prolog ALU) Mild Shock <janburse@fastmail.fm> - 2025-10-15 04:33 +0200
NPUs (Neural Processing Units) are the new normal (Was: 25-30% is insane, Neural Network Branch Prediction?) Mild Shock <janburse@fastmail.fm> - 2025-10-15 16:04 +0200
Ask Phind: AI inflection point right now [End 2025] (Was: NPUs (Neural Processing Units) are the new normal) Mild Shock <janburse@fastmail.fm> - 2025-10-15 16:10 +0200
Eat Tteokbokki before SkyNet kills you [$100 ChatGPT] (Was: Ask Phind: AI inflection point right now [End 2025]) Mild Shock <janburse@fastmail.fm> - 2025-10-18 15:57 +0200
Give Julio Di Egidio the bloody money [3 RMB¥ MiniMind] (Re: Eat Tteokbokki before SkyNet kills you [$100 ChatGPT]) Mild Shock <janburse@fastmail.fm> - 2025-10-18 16:19 +0200
Vertex AI Training is more expensive? (Was: Give Julio Di Egidio the bloody money [3 RMB¥ MiniMind]) Mild Shock <janburse@fastmail.fm> - 2025-10-21 00:32 +0200
The Love Affair: OpenAI and AMD (Was: NPUs (Neural Processing Units) are the new normal) Mild Shock <janburse@fastmail.fm> - 2025-10-18 18:59 +0200
The NPU in your Browser [WebNN by W3C] (Was: NPUs (Neural Processing Units) are the new normal) Mild Shock <janburse@fastmail.fm> - 2025-10-26 08:39 +0100
Fuzzy Alert: Boris the Loris on the Dancefloor (Was: The NPU in your Browser [WebNN by W3C]) Mild Shock <janburse@fastmail.fm> - 2025-10-26 11:33 +0100
csiph-web