]> Repositorios git - scryer-prolog.git/commit
ENHANCED: use a fast test for the expected case of chars in atom_chars/2 etc.
authorMarkus Triska <[email protected]>
Thu, 24 Apr 2025 16:19:05 +0000 (18:19 +0200)
committerMark Thom <[email protected]>
Tue, 8 Jul 2025 05:38:12 +0000 (22:38 -0700)
commite9bb41f0d69e0fbaa848ff3a25d9d2dd04a80487
tree86a4d25ac0081ea99e965d342aaf7e48098ab4f0
parentb12d1ece1783755a3fe96df310366721c079e30e
ENHANCED: use a fast test for the expected case of chars in atom_chars/2 etc.

Suggested by Oleg Finkelstein, thank you a lot!

Example, before this change:

    ?- t+\(length(As, 1_000_000), maplist(=(a), As), time(atom_chars(A, As))).
       % CPU time: 0.693s, 7_000_041 inferences
       true.

Now:

    ?- t+\(length(As, 1_000_000), maplist(=(a), As), time(atom_chars(A, As))).
       % CPU time: 0.080s, 40 inferences
       true.

This also partially ameliorates #2907.
src/lib/builtins.pl