Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:03:44+00:00 2026-06-04T07:03:44+00:00

I have a project that use JSON as cross-language serialization to pass around data.

  • 0

I have a project that use JSON as cross-language serialization to pass around data. Recently the size of the data grows a little huge (10k length list of objects). It takes python standard json library around 20 seconds to serialize the data.

I am working to optimize the time. While switch to other json serializer (cjson, simplejson, ujson) can speed things up quite a bit, I am start to wondering the time complexity of JSON serialization. If the relationship is not linear (say if it is n^2) I can easily chop the data in chunks and reduce the time significantly.

From what I guessed, the complexity should really depends on the input data. But is there a worst-case/average estimation available? A link to reference will be highly appreciated too.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:03:45+00:00Added an answer on June 4, 2026 at 7:03 am

    I’ve benchmarked the time complexity with this code:

    import json
    import random
    import time
    
    Ns = 10, 100, 1000, 10000, 100000, 200000, 300000, 600000, 1000000
    for N in Ns:
        l = [random.random() for i in xrange(N)]
        t0 = time.time()
        s = json.dumps(l)
        t1 = time.time()
        dt = t1-t0
        print "%s %s" % (N, dt) 
    

    On my machine, the outcome is:

    10 7.20024108887e-05
    100 0.000385999679565
    1000 0.00362801551819
    10000 0.036504983902
    100000 0.366562128067
    200000 0.73614192009
    300000 1.09785795212
    600000 2.20272803307
    1000000 3.6590487957
    

    First column: list length; second column: time for serialization. Plotting (with for example xmgrace) reveals an ideal linear relation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Library Project that we use for all our central reused code
Good day, I have a library project that i use to create a paid
I have inherited a web site project that makes use of a number of
My use case is this... I have a project that has two production branches.
I know that I can use popToRootViewController if I have navigationController in my project
I have a project that I have recently started working on seriously but had
I am trying to use the library spring-json.1.3.1 in a project that has been
Is it possible to use Phonegap's Build service to build projects that may have
I have a project that is supposed to run on different (at least 2)
I have a project that uses two third party libraries, both of which make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.