Ticket #1857 (closed enhancement: fixed)
buildbot.util should prefer simplejson over built-in json
| Reported by: | catlee | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.8.4 |
| Version: | 0.8.3p1 | Keywords: | |
| Cc: |
Description
Python 2.6's json is significantly slower than simplejson.
import json
import simplejson
import time
def task(module, data):
encoded = module.dumps(data)
orig = module.loads(encoded)
assert data == orig
n = 1000
data = {}
for i in range(100):
data[str(i)] = "hello" * i
for module in json, simplejson:
s = time.time()
for i in range(n):
task(module, data)
e = time.time()
print module.__name__, e-s
outputs
json 1.52023100853 simplejson 0.200721979141
on my system with python 2.6.6.
Python 2.7 is much improved:
json 0.206233024597 simplejson 0.189265012741
Buildbot should prefer simplejson for python <= 2.6.
Change History
Note: See
TracTickets for help on using
tickets.
![[Buildbot Logo]](/chrome/site/header-text-transparent.png)
Fixed by d97698c393aa0894c47369266c3f726280f2c96b