Giter Site home page Giter Site logo

deserializer's Introduction

Deserializer

Build status

Summary

Deserializes JS objects of given shape using RestSharp JsonDeserializer underneath. Given library limitations as described on stack overflow the process happens two-phase. First is deserialization into interim representation using JsonArray for the outer Entries list. Thereafter individual entries from that array are being individually re-processed, which includes serialization and final deserialization. The logic is wrapped into DocumentDeserializer class and its usage is demonstrated in unit test DocumentDeserializerTests#Original_structure_indirect_deserialization.

Load tests

Since above mentioned re-processing happens to achieve fully-typed result class it obviously has performance impact. LoadTests 'unit-tests' serve the purpose of meassuring that against two variables - number of entries and number of loops. OriginalLoadTest uses the two-phase parsing as described above and AlternativeLoadTest depends strictly on JsonDeserializer by using a bit modified input JSON structure. The results are as follows (sorted by ascending entries multiplied loops):

Version # of entries # of loops Total time [ms]
Original 2 500 147
Alternative 2 500 119
Original 10 500 505 *
Alternative 10 500 897 *
Original 2 5000 1548
Alternative 2 5000 1192
Original 20 500 919
Alternative 20 500 718
Original 10 5000 4906
Alternative 10 5000 3846
Original 20 5000 9171
Alternative 20 5000 7348

Most of the cases alternative is superior, however for 10/500 case it is the opposite. Since the result persisted as such on subsequent 1.0.7 and 1.0.8 runs the guess is that GC collection may be influencing the result. This requires further investigation.

Original format

{
  "has_title": true,
  "title": "GoodLuck",
  "entries": [
    [
      "/gettingstarted.pdf",
      {
        "thumb_exists": false,
        "path": "/GettingStarted.pdf",
        "client_mtime": "Wed, 08 Jan 2014 18:00:54+0000",
        "bytes": 249159
      }
    ],
    [
      "/task.jpg",
      {
        "thumb_exists": true,
        "path": "/Task.jpg",
        "client_mtime": "Tue, 14 Jan 2014 05:53:57+0000",
        "bytes": 207696
      }
    ]
  ]
}

Alternative format

{
  "has_title": true,
  "title": "GoodLuck",
  "entries": {
    "/gettingstarted.pdf": {
      "thumb_exists": false,
      "path": "/GettingStarted.pdf",
      "client_mtime": "Wed, 08 Jan 2014 18:00:54+0000",
      "bytes": 249159
    },
    "/task.jpg": {
      "thumb_exists": true,
      "path": "/Task.jpg",
      "client_mtime": "Tue, 14 Jan 2014 05:53:57+0000",
      "bytes": 207696
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.