I can make a case of such a comparison,
DCG pipe dream versus proper look-ahead:
/* Scryer Prolog 0.9.4-135 */
?- time((between(1,1000,_), data(X), json_chars(Y,X,[]), fail; true)).
% CPU time: 0.283s, 2_506_022 inferences
true.
/* SWI-Prolog 9.3.8 */
?- time((between(1,1000,_), data(X), atom_json_term(X,Y,[]), fail; true)).
% 44,998 inferences, 0.016 CPU in 0.006 seconds (281% CPU, 2879872 Lips) true.
I think the speed difference of a factor
20x is not because of native float parsing.
The example doesn’t have much float:
data("{ \"a\":123 }").
So whats the bug in the DCG parser by
Scryer Prolog? Why does the parser written by
Jan W. not have the same defect?
Why does the number of inferences differ so much?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 491 |
Nodes: | 16 (3 / 13) |
Uptime: | 147:36:04 |
Calls: | 9,695 |
Calls today: | 5 |
Files: | 13,732 |
Messages: | 6,178,673 |