This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author poq
Recipients poq
Date 2011-05-21.13:38:06
SpamBayes Score 0.003311057
Marked as misclassified No
Message-id <1305985086.83.0.259963774289.issue12134@psf.upfronthosting.co.za>
In-reply-to
Content
import json, timeit
obj = [[1,2,3]*10]*10
class writable(object):
	def write(self, buf): pass
w = writable()
print('dumps: %.3f' % timeit.timeit(lambda: json.dumps(obj), number=10000))
print('dump:  %.3f' % timeit.timeit(lambda: json.dump(obj,w), number=10000))

On my machine this outputs:
dumps: 0.391
dump:  4.501

I believe this is mostly caused by dump using JSONEncoder.iterencode without _one_shot=True, resulting in c_make_encoder not being used.
History
Date User Action Args
2011-05-21 13:38:06poqsetrecipients: + poq
2011-05-21 13:38:06poqsetmessageid: <1305985086.83.0.259963774289.issue12134@psf.upfronthosting.co.za>
2011-05-21 13:38:06poqlinkissue12134 messages
2011-05-21 13:38:06poqcreate