[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How efficient are XML parsers?

  • From: Elliotte Rusty Harold <elharo@ibiblio.org>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Wed, 15 Nov 2017 12:26:50 -0500

Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.