XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] How efficient are XML parsers?

"A JSON parser needs to build a field mapping before it can start parsing"

I don't see how this is a requirement. It certainly is one approach a
JSON parser can take, and one many do take; but I don't think it's
necessary by any means.



On Wed, Nov 15, 2017 at 7:07 AM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
>
>
> I recently read an article about Facebook dumping JSON due to inadequate
> performance of JSON parsers. See below. I wonder how XML parsers would stack
> up. Do you have numbers?
>
>
>
> Parse a 20KB stream
>
> Facebook requirement: must not exceed the UI frame refresh interval of 16.6
> ms
>
> JSON parser: 35 ms to parse a JSON stream of 20 KB (a typical response size
> for Facebook)
>
> XML parser: ??
>
>
>
> Parser initialization
>
> Facebook requirement: Not specified
>
> JSON parser: 100 ms to 200 ms before it can start parsing
>
> XML parser: ??
>
>
>
> Garbage collection
>
> Facebook requirement: Not specified
>
> JSON parser: 100 KB of transient memory allocated when parsing a JSON stream
> of 20 KB
>
> XML parser: ??
>
>
>
> Here’s why Facebook dumped JSON
>
> As you know, people use Facebook to create connections with family and
> friends. Facebook stores all the data that makes up the social graph of
> these connections. On mobile clients, the entire graph can’t be downloaded,
> so only a node and some of its connections are downloaded as a local tree
> structure.
>
> One of the key issues Facebook needed to address was how to represent and
> store the social graph data in an app. Their initial approach was to store
> the data in JSON. They used the Jackson JSON parser on Android. However,
> they dumped JSON after finding these issues:
>
> Parsing speed. It took 35 ms to parse a JSON stream of 20 KB (a typical
> response size for Facebook), which exceeds the UI frame refresh interval of
> 16.6 ms. Users were unable to load stories on demand from disk cache without
> observing frame drops (visual stutters) while scrolling.
>
> Parser initialization. A JSON parser needs to build a field mapping before
> it can start parsing, which can take 100 ms to 200 ms, substantially slowing
> down the application start time.
>
> Garbage collection. A lot of small objects are created during JSON parsing,
> and testing revealed around 100 KB of transient memory was allocated when
> parsing a JSON stream of 20 KB, which placed significant pressure on the
> garbage collector.
>
> Facebook needed a better storage format to increase the performance of their
> Android app.
>
> What did they choose?
>
> Answer: Google FlatBuffers.
>
> https://code.facebook.com/posts/872547912839369/improving-facebook-s-performance-on-android-with-flatbuffers/
>
> /Roger
>
>



-- 
Elliotte Rusty Harold
elharo@ibiblio.org


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS