This website requires JavaScript.
Explore
Help
Sign in
GlcoinCore
/
Fulcrum
Watch
1
Star
0
Fork
You've already forked Fulcrum
0
mirror of
https://github.com/cculianu/Fulcrum.git
synced
2026-08-18 13:09:12 +02:00
Code
Issues
Projects
Releases
Packages
Wiki
Activity
Actions
cpp20
Fulcrum
/
test
/
json
/
fail1.json
1 line
69 B
JSON
Raw
Permalink
Normal View
History
Unescape
Escape
Fixups and optimizations to JSON Parsing + set all locale APIs to "C" (#30) - Added a "fast path" to the JSON parser for strings (""). The optimistic case is that the string data is just pure ascii, with no escape chars. In that case, we simply take a shallow copy of the buffer we are currently parsing. This avoids using the (slow) `JSONUTF8StringFilter` to process unicode and unicode escapes (which does `push_back()` per character). The fast path offers a 10% or more speedup on JSON parsing (as well as fewer mallocs -> less heap fragmentation over time). - JSON parser takes shallow copies of string data whenever it can do so (conceptually similar to `std::string_view`), to avoid on redundant copies and mallocs. - Overall JSON parser is ~15% faster now. - Fixed the correctness bug where unicode code point `\u0000` would end up being interpreted as end-of-string. We can now pass the original UniValue lib's `round1.json` test. This bug was due to the way `QString::fromUtf8` worked for `QByteArray`s. It turns out passing QString a raw C pointer with a size param is better. See: [This line of code](https://github.com/qt/qtbase/blob/ba3b53cb501a77144aa6259e48a8e0edc3d1481d/src/corelib/text/qstring.h#L701) versus [this line of code](https://github.com/qt/qtbase/blob/ba3b53cb501a77144aa6259e48a8e0edc3d1481d/src/corelib/text/qstring.h#L709). - Added more corner-case JSON tests - We also set the C++ locale and the Qt default `QLocale` to `"C"` as well on startup.. just in case.
2020-07-15 14:08:07 +03:00
"
T
h
i
s
i
s
a
s
t
r
i
n
g
t
h
a
t
n
e
v
e
r
e
n
d
s
,
y
e
s
i
t
g
o
e
s
o
n
a
n
d
o
n
,
m
y
f
r
i
e
n
d
s
.
Reference in a new issue
Copy permalink