Loading ...
Sorry, an error occurred while loading the content.

970Re: JPath - xpath for json

Expand Messages
  • plexium_nerd
    Apr 3, 2008
    • 0 Attachment
      I'm not sure if this benchmark is useful or not but i threw together a
      set of three tests which just iterates over equivalent queries 1000
      times. Since there's two ways of querying in JPath, I used both to show
      the performance difference. The time represents milliseconds.

      Other than JPath's (xpath query), the two libraries are pretty evenly
      matched as far as speed goes.
      Test 1JSONPath : $.store.book[?(@.price < 10)].title = Sayings of the
      Century,Moby Dick
      Time: 468

      JPath (xpath query) : /store/book[price < 10]/title = Sayings of the
      Century,Moby Dick
      Time: 766

      JPath (js query) : $('store').$('book').f('j.$("price").json <
      10').$('title').json = Sayings of the Century,Moby Dick
      Time: 531 Test 2JSONPath : $.store.book[(@.length-1)].title = The Lord
      of the Rings
      Time: 313

      JPath (xpath query) : /store/book[last()]/title = The Lord of the Rings
      Time: 500

      JPath (js query) : $('store').$('book').f('j.last()').$('title').json =
      The Lord of the Rings
      Time: 297 Test 3JSONPath : $.store.book[0].title = Sayings of the
      Century
      Time: 171

      JPath (xpath query) : /store/book[0]/title = Sayings of the Century
      Time: 407

      JPath (js query) : $('store').$('book').$(0).$('title').json = Sayings
      of the Century
      Time: 172

      --- In json@yahoogroups.com, "Gustavo Munoz" <justavo@...> wrote:
      >
      > Have you run any benchmark between both libraries for some of the
      common
      > features?
      >
      > On Tue, Apr 1, 2008 at 3:31 PM, plexium_nerd plexium.nerd@... wrote:
      >
      > > When I decided to make Jpath, no. It wasn't until afterwards when
      i
      > > found that library. However, they are still pretty different and
      each
      > > offer different features.
      > >
      > > JPath allows for actual XPath syntax (ie, /book/chapter[/@num=1] ),
      > > in addition to XPath-like syntax using the structure of javascript.
      > >
      > > myjpath.$('book/title').json;
      > >
      > > does the same as
      > >
      > > myjpath.query('book/title');
      > >
      > >
      > > --- In json@yahoogroups.com <json%40yahoogroups.com>, "kriszyp"
      > > kriszyp@ wrote:
      > > >
      > > > Are you aware of JSONPath, and XPath-like functionality for JSON
      that
      > > > it already provides?
      > > > http://goessner.net/articles/JsonPath/
      > > >
      > > >
      > > > --- In json@yahoogroups.com <json%40yahoogroups.com>,
      "plexium_nerd" <
      > > plexium.nerd@> wrote:
      > > > >
      > > > > Howdy All, I'd just like to put my JPath library out there in
      case
      > > > > others might find it as useful as i did.
      > > > >
      > > > > http://bluelinecity.com/software/jpath
      > > > > <http://bluelinecity.com/software/jpath>
      > > > >
      > > > > JPath is a simple lightweight Javascript Class which provides an
      > > > > XPath-like querying ability to JSON objects.
      > > > >
      > > > > Thanks!
      > > > > -bryan
      > > > >
      > > > >
      > > > >
      > > > > [Non-text portions of this message have been removed]
      > > > >
      > > >
      > >
      > >
      > >
      >
      >
      >
      > --
      > Blog: http://justavo.blogsome.com/
      >
      >
      > [Non-text portions of this message have been removed]
      >



      [Non-text portions of this message have been removed]
    • Show all 5 messages in this topic