Commit Graph
264 Commits
Author SHA1 Message Date
Nigel Tao 3faddde52d Fix imageviewer signed/unsigned char comparison 2020-12-24 22:30:32 +11:00
Nigel Tao 58c30e9d6d Add std/png 2020-12-24 13:10:29 +11:00
Nigel Tao 1197e86616 Add std/nie 2020-12-23 14:53:56 +11:00
Nigel Tao 904004e79a Let non-strict JSON Pointer syntax allow "~t" 2020-11-15 20:56:04 +11:00
Nigel Tao cd4cbc9102 Tweak JSON trailing comment/new-line quirks 2020-09-22 23:03:49 +10:00
Nigel Tao fa50f4de67 Add json QUIRK_ALLOW_TRAILING_COMMENT 2020-09-21 11:24:22 +10:00
Nigel Tao b55d539d94 Add links to jsonptr blog post 2020-09-11 08:11:02 +10:00
Nigel Tao 6c13877688 Drop WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_BYTES
We can always add it back later if there's demand for it.
2020-08-30 16:15:35 +10:00
Nigel Tao 8d779ae1cd Add jsonfindptrs -only-parse-dont-output flag 2020-08-29 23:10:08 +10:00
Nigel Tao 5396dbd17d Have jsonfindptrs use C++17's std::variant
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m7.333s
After:
real    0m5.970s
Ratio: 1.23x

Using "/usr/bin/time -v" instead of "time"
Before this commit:
Maximum resident set size (kbytes): 2556992
After:
Maximum resident set size (kbytes): 1214812
Ratio: 2.10x
2020-08-29 22:23:15 +10:00
Nigel Tao 9d69939f2c Have jsonfindptrs factor out escape_needed
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m7.550s
After:
real    0m7.333s
Ratio: 1.03x
2020-08-29 10:56:37 +10:00
Nigel Tao b6c01b3464 Have jsonfindptrs cache std::to_string(i)
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m8.822s
After:
real    0m7.550s
Ratio: 1.17x
2020-08-29 10:46:04 +10:00
Nigel Tao 8098d96113 Have jsonfindptrs re-use the output string buffer
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m9.774s
After:
real    0m8.822s
Ratio: 1.11x
2020-08-29 10:41:05 +10:00
Nigel Tao feded888dd Have jsonfindptrs not flush stdout after each line
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real	0m21.104s
After:
real	0m9.774s
Ratio: 2.16x
2020-08-29 10:33:41 +10:00
Nigel Tao 63e6796896 Add "4Ki tokens is 32KiB" comment 2020-08-26 00:00:32 +10:00
Nigel Tao 7fd3bb661a Fix -Wswitch in example/jsonfindptrs 2020-08-24 21:34:53 +10:00
Nigel Tao 75682548f5 Add example/jsonptr -output-inf-nan-numbers flag 2020-08-22 21:40:18 +10:00
Nigel Tao ade016523b Optimize example/jsonptr string conversion
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.687s
After:
real    0m1.677s
Ratio: 1.01x
2020-08-21 15:57:51 +10:00
Nigel Tao 3f688b2677 Optimize example/jsonptr token VBD switch
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.765s
After:
real    0m1.687s
Ratio: 1.05x
2020-08-21 15:51:48 +10:00
Nigel Tao 6344181b96 Add look-up table for JSON ASCII escapes
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.799s
After:
real    0m1.765s
Ratio: 1.02x
2020-08-21 14:11:31 +10:00
Nigel Tao 50db4a47fb Inline example/jsonptr's handle_token
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.911s
After:
real    0m1.799s
Ratio: 1.06x
2020-08-20 11:31:28 +10:00
Nigel Tao 2104205d25 Let example/jsonptr output comments
Performance (on vanilla, comment-free JSON) slips a little.

On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.863s
After:
real    0m1.911s
Ratio: 0.97x   Inverse: 1.03x
2020-08-20 11:14:29 +10:00
Nigel Tao 6b86cbcb25 Optimize example/jsonptr's write_dst
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.949s
After:
real    0m1.863s
Ratio: 1.05x
2020-08-19 15:53:06 +10:00
Nigel Tao 991bd51306 Rename some example/jsonptr variables 2020-08-19 09:38:16 +10:00
Nigel Tao 0a0c7d68aa Optimize example/*json*'s indentation output
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m3.612s
After:
real    0m1.949s
Ratio: 1.85x
2020-08-19 00:02:30 +10:00
Nigel Tao 2742a4f4be Have wuffs_aux take lvalue (not rvalue) references 2020-08-17 00:02:49 +10:00
Nigel Tao 0291a47dc8 Remove example/jsonptr's ability to speak CBOR
Originally, the example/jsonptr program read JSON from stdin and wrote
JSON to stdout. Over the course of numerous recent commits, it gained
the ability to read either CBOR or JSON and write either CBOR or JSON.
(CBOR is, very roughly, a binary file format similar to the JSON text
file format). While a useful feature, the extra code hurt JSON-to-JSON
performance, the original motivating purpose of that program. This
commit reverts that feature, re-gaining original performance. (The
example/cbor-to-json and example/json-to-cbor programs were recently
added to convert between CBOR and JSON, covering that feature loss).

On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real	0m5.095s
After:
real	0m3.583s
Ratio: 1.42x

$ sloccount example/jsonptr/jsonptr.cc | grep ^cpp
Before this commit:
cpp:           1508 (100.00%)
After:
cpp:            869 (100.00%)
Ratio: 1.74x

This commit brings jsonptr.cc approximately to its state just before
168f60a7 "Add example/jsonptr -output-format=cbor flag" was committed,
although it keeps the flags added since then for allowing comments and
inf/NaN numbers.
2020-08-13 22:58:59 +10:00
Nigel Tao b3438434ca Add json QUIRK_JSON_POINTER_ALLOW_TILDE_R_TILDE_N 2020-08-13 00:06:56 +10:00
Nigel Tao 8aac6767bb Add example/jsonfindptrs -query=STR flag 2020-08-12 23:18:37 +10:00
Nigel Tao da3504833e Have Decode{Cbor,Json} quirks default to empty 2020-08-11 13:46:50 +10:00
Nigel Tao ca5da1fb9d Have example C++ programs use override specifier 2020-08-10 15:30:12 +10:00
Nigel Tao 62c4feb268 Let wuffs_aux::DecodeJson use BACKSLASH_X_AS_BYTES 2020-08-10 15:22:05 +10:00
Nigel Tao 6d81764e14 Tweak wuffs_aux::DecodeJsonCallbacks 2020-08-09 23:15:41 +10:00
Nigel Tao 484c1d5fc3 Delete unused MAX_INDENT definition 2020-08-09 23:11:06 +10:00
Nigel Tao 0b7eaf291b Add example/cbor-to-json 2020-08-09 23:03:42 +10:00
Nigel Tao 0a5940d399 Tweak example/jsonfindptrs -input-etc flags 2020-08-07 13:15:41 +10:00
Nigel Tao cf8884d44c Rename example/library to example/toy-genlib 2020-08-05 11:55:51 +10:00
Nigel Tao 50bfab9998 Tweak example/*/*.cc compile instructions 2020-08-05 11:39:09 +10:00
Nigel Tao f557dad608 Add example/json-to-cbor 2020-08-04 23:45:46 +10:00
Nigel Tao cf6c578973 Add aux library 2020-08-04 23:43:38 +10:00
Nigel Tao 0a68f6332a Have jsonptr pass through CBOR floating points 2020-07-28 10:39:32 +10:00
Nigel Tao c96b31c7bf Suppress jsonptr byte string output when in query 2020-07-27 23:07:49 +10:00
Nigel Tao 77c7551b26 Fix jsonptr whitespace and commas for CBOR tags 2020-07-27 21:35:11 +10:00
Nigel Tao 35c4e9532b Fix jsonptr's JSON output for CBOR simple values 2020-07-27 18:01:05 +10:00
Nigel Tao 983a74f257 Let jsonptr accept integer CBOR map keys 2020-07-27 15:56:56 +10:00
Nigel Tao ee6927fcdb Have jsonptr pass around slice_u8 more often 2020-07-27 12:08:33 +10:00
Nigel Tao d6a10dfe8a Add io_buffer.{read,writ}er_slice methods 2020-07-27 11:47:47 +10:00
Nigel Tao ea53245441 Have jsonptr base64url encode CBOR byte strings 2020-07-27 00:03:00 +10:00
Nigel Tao dd114696d8 Let jsonptr output inf and NaN 2020-07-25 21:55:30 +10:00
Nigel Tao 5a616b6693 Have std/cbor parse floating point numbers 2020-07-24 23:54:52 +10:00