So i'm making a request to an API that returns around 5000 results. Data structure looks like so:
[{'test': '1'}, {'test': '2'}, {'test': '3'}]
(Only with 5000 results)
It's currently taking around 30 seconds to do this simple construct:
for x in ujson.loads(r.content):
pass
As you can see I'm using ujson
but it doesn't even really speed it compared to json.loads()
.
Any ideas on how to improve this performance?
Thanks
As requested, how im timing the code:
start = time.time()
r = requests.get(url, headers={'Range': 'items=1-5000'})
print 'time to make request: {0}'.format(time.time() - start)
for x in ujson.loads(r.content):
pass
print 'time to parse request: {0}'.format(time.time() - start)