You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
Using the webapp2.Response object as a writer for json.dump appears to hit
quadratic string concatenation complexity and is extremely slow.
Test case app:
import json
import time
import webapp2
class Test(webapp2.RequestHandler):
def get(self):
data = ['test'] * int(1e6)
start = time.time()
if self.request.get('method') == 'dumps':
self.response.write(json.dumps(data))
else:
json.dump(data, self.response)
print 'Time taken: %ss' % (time.time() - start)
application = webapp2.WSGIApplication([
('/test', Test),
], debug=True)
Stdout for http://localhost:8080/test?method=dump:
Time taken: 7.93935012817s
Stdout for http://localhost:8080/test?method=dumps:
Time taken: 0.123687982559s
Original issue reported on code.google.com by [email protected] on 24 Sep 2014 at 4:20
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 24 Sep 2014 at 4:20The text was updated successfully, but these errors were encountered: