Nп/п : 70 из 87
 От   : Mild Shock                          2:5075/128        09 сен 23 13:18:19
 К    : Mild Shock                                            09 сен 23 23:21:03
 Тема : Re: Request for comments: Two types of float of integer division
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<f3083699-800d-45c6-b622-cea67bac91fbn@googlegroups.com> 2179799f
@REPLY:
<5848823c-8c71-4d67-8dc0-42a72aaa95acn@googlegroups.com> 57ac3530
@REPLYADDR Mild Shock <bursejan@gmail.com>
@REPLYTO 2:5075/128 Mild Shock
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<616590d2-4927-4f60-ba91-acef849695a3n@googlegroups.com> <b4fe1397-91ae-472c-9365-dbd8e0937f27n@googlegroups.com>
<a6ed877b-5d7d-4404-b41c-ee58c12ba6a0n@googlegroups.com> <5848823c-8c71-4d67-8dc0-42a72aaa95acn@googlegroups.com>
@RFC-Message-ID:
<f3083699-800d-45c6-b622-cea67bac91fbn@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
The internal call is tail recursive I guess, since the functor is
already checked, and a looked up handle, a function pointer,
causes the evaluation. Recently GNU Prolog has moved to GitHub,

so I can find the source code of GNU Prolog stuff more easily, things
like Load Math Expression. But I think the GNU Prolog approach is
only feasible, if you dare to rely on the native stack.

Concerning the new Java foreign function interface. I switched
from handles obtained by method reflection to handles that were
populated via functional interfaces. Its an itch faster, and close

to SWI-Prolog optimised, but only for JDK 8:

/* Jekejeke Prolog, 1.6.3, JDK 8, Functional Interface */
?- time(test).
% Time 171 ms, GC 2 ms, Wall 09/09/2023 22:04
true.

The above uses the native stack like GNU Prolog and no
cycle testing nothing. But I guess it burns CPU since it uses
two pointers to represent a term. I hope I can soon get rid of that.

Another brake could be the varargs array allocation.

Mild Shock schrieb am Samstag, 9. September 2023 um 22:17:13 UTC+2:
> I started using this test case: 

> test :- 
> between(0,1000000,N), 
>   is exp(1+N/1000000), 
> fail. 
> test. 

> To test a new Java foreign function interface. I then 
> observed that SWI-Prolog stack engine causes 
> a little overhead: 

> /* SWI-Prolog, 9.1.14, optimise=false */ 
> ?- time(test). 
> % 2,000,001 inferences, 0.313 CPU in 0.315 seconds 
> (99% CPU, 6400003 Lips) 
> true. 

> /* SWI-Prolog, 9.1.14, optimise=true */ 
> ?- time(test). 
> % 1,000,002 inferences, 0.172 CPU in 0.176 seconds 
> (98% CPU, 5818193 Lips) 
> true. 

> Intrestingly GNU Prolog doesn`t use a stack engine, 
> just relies on the native stack. Its quite speedy without 
> any optimisation: 

> /* GNU Prolog 1.5.0 (64 bits) */ 
> ?- test. 
> (125 ms) yes
--- G2/1.0
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх