Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9d9b4e70 authored by Jesse Wilson's avatar Jesse Wilson
Browse files

Decode JSON literal types eagerly and with our own decoder.

Previously we relied on Double.parseDouble() to decode tokens. Since
that method is expensive, we deferred calling it unless absolutely
necessary.

Now we decode the literal type immediately. For efficiency we decode
the token right out of the char buffer. This makes things more
complicated but it saves many calls to charAt().

With this change overall performance is 7% faster for JSON documents
cited in the bug.

    benchmark                     run  ms linear runtime                    %
GsonParseFull no switch, no int parse 309 ============================    93%
GsonParseFull                baseline 330 ============================== 100%

http://b/3201883
Change-Id: I436b6769956b1357a17c807a327d3a234691c73f
parent 762b33f9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment