Rewrote many parts of library(json) to leave no choicepoints when generating JSON. However, the generating performance actually worsened slightly...

This commit is contained in:
panasenco
2021-04-22 13:31:06 -07:00
parent d3caba4073
commit 828550687c
4 changed files with 165 additions and 147 deletions

View File

@@ -1,13 +1,38 @@
## Benchmarks
### With CLP(Z):
### Read
With CLP(Z):
```
?- test_json_read.
?- test_json:test_json_read.
% CPU time: 41.522 seconds
```
### After removing CLP(Z):
After removing CLP(Z):
```
?- test_json_read.
?- test_json:test_json_read.
% CPU time: 0.444 seconds
```
With first argument indexing optimizations:
```
?- test_json:test_json_read.
% CPU time: 0.310 seconds
```
### Write
Without first argument indexing optimizations:
```
?- test_json:test_json_minify.
% CPU time: 0.014 seconds
```
With first argument indexing optimizations:
```
?- test_json:test_json_minify.
% CPU time: 0.015 seconds
```

View File

@@ -34,7 +34,7 @@ test_json_minify :-
read_line_to_chars(RefMin, RefChars, []),
close(RefMin),
name_parse("pass_everything.json", Json),
time(once(phrase(json_chars(Json), MinChars))),
time(phrase(json_chars(Json), MinChars)),
RefChars = MinChars.
test_json_int_float :-