Commit Graph
75 Commits
Author SHA1 Message Date
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 484c1d5fc3 Delete unused MAX_INDENT definition 2020-08-09 23:11:06 +10:00
Nigel Tao 50bfab9998 Tweak example/*/*.cc compile instructions 2020-08-05 11:39:09 +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
Nigel Tao c9e2010040 Tweak std/cbor TOKEN_VALUE_MINOR__ETC bits 2020-07-24 23:19:12 +10:00
Nigel Tao 042e94f304 Have std/cbor parse simple values 2020-07-24 23:14:27 +10:00
Nigel Tao 271680333e Have std/cbor parse tags 2020-07-24 15:54:44 +10:00
Nigel Tao f8dfc76310 Have std/cbor parse objects 2020-07-24 11:41:22 +10:00
Nigel Tao 702c7b299f Let wuffs_base__utf_8__etc take ptr-to-const-u8 2020-07-22 15:42:54 +10:00
Nigel Tao 03a87ea3ef Add jsonptr check for to-be-extended token length 2020-07-21 23:29:26 +10:00
Nigel Tao 850dc18d16 Have std/cbor produce extended inline integers 2020-07-21 22:52:04 +10:00
Nigel Tao c9d4e34dfc Split ETC__VBC__INLINE_INTEGER into {,un}signed 2020-07-21 15:31:49 +10:00
Nigel Tao 51a38295b6 Let jsonptr accept inf and NaN 2020-07-19 22:47:34 +10:00
Nigel Tao 7cb7654a4d Re-organize jsonptr.cc 2020-07-19 22:19:04 +10:00
Nigel Tao d191a3fc5f Have std/cbor parse text strings 2020-07-19 22:17:48 +10:00
Nigel Tao 3c8589b6e9 Let jsonptr output CBOR metadata as JSON comments 2020-07-19 21:49:00 +10:00
Nigel Tao af75772cc2 Have std/cbor parse byte strings 2020-07-18 17:27:11 +10:00
Nigel Tao 664f8431d2 Have std/cbor parse negative integers 2020-07-16 21:25:14 +10:00
Nigel Tao 4e193599ac Add std/cbor 2020-07-15 14:08:37 +10:00
Nigel Tao 168f60a781 Add example/jsonptr -output-format=cbor flag 2020-07-14 15:57:05 +10:00
Nigel Tao cd183f92b0 Fix jsonptr start_of_token_chain initial value 2020-07-14 12:11:05 +10:00
Nigel Tao ecadf72e6b Rename some example/json* flags 2020-07-13 08:25:59 +10:00
Nigel Tao c766bb72d6 Have example/jsonetc read and write extra commas 2020-07-09 13:15:36 +10:00
Nigel Tao 6b7ce30e32 Add wuffs_base__parse_number_xxx options arg 2020-07-07 16:19:46 +10:00
Nigel Tao 496e88b6c5 Remove wuffs_base__token__link_prev 2020-04-09 22:11:08 +10:00
Nigel Tao 2ef3999d6d Remove use of wuffs_base__token__link_prev 2020-04-09 17:24:39 +10:00
Nigel Tao 721190afff Have example C++ program check for -std=c++11 2020-04-03 22:25:21 +11:00
Nigel Tao 94440cf6ff Rename example/json* -o flag 2020-04-02 22:28:24 +11:00
Nigel Tao 462f86675d Add an "extended token" concept 2020-04-02 11:20:45 +11:00
Nigel Tao d60815c93f Have example/* global variable names start with g_ 2020-03-26 14:32:35 +11:00
Nigel Tao f3146c2ea9 Add base.token_decoder.workbuf_len 2020-03-26 08:47:42 +11:00
Nigel Tao 4b186b0b6b Add std/json quirk_allow_trailing_etc 2020-03-18 16:42:06 +11:00
Nigel Tao f2eb7014ea Expand example/jsonptr memory safety comment 2020-03-16 21:10:20 +11:00
Nigel Tao 18ef5b458c Fix -Wswitch warnings in example/json* 2020-03-16 10:37:47 +11:00
Nigel Tao d0b16cb492 Add example/jsonfindptrs 2020-03-15 23:15:07 +11:00
Nigel Tao b48ee75e0b Change example/jsonptr C++ member name style 2020-03-13 09:27:33 +11:00
Nigel Tao 3690e83d86 Rename example/jsonptr's -compact flag 2020-03-12 16:52:26 +11:00
Nigel Tao d6fdfb133f Add example/jsonptr -strict-json-pointer-syntax 2020-03-12 11:32:28 +11:00
Nigel Tao 52c4d6ae4b Add example/jsonptr -max-output-depth flag 2020-03-08 21:12:38 +11:00
Nigel Tao fdac24a425 Rename FOO_BUFFER_SIZE to FOO_BUFFER_ARRAY_SIZE 2020-03-06 21:53:08 +11:00
Nigel Tao 01abc84784 Let example/jsonptr take a filename arg 2020-03-06 21:42:33 +11:00