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 vstinner
Recipients pitrou, r.david.murray, serhiy.storchaka, vstinner
Date 2013-04-21.02:03:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366509808.92.0.502616719861.issue17742@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not completly satisfied of bytes_writer-2.patch. Most encoders work directly on a pointer (char*). If I want to keep the code using pointers (because it is efficient), I have to resynchronize the writer and the pointer before and after calling writer methods.

Here is a new patch implementing a different approach, closer to the current code. The patch version 3 has no "pos" attribute: the "position" is now a pointer (str). So encoders can just use this pointer instead of their own pointer.

I expect that replacing "*p++ = c;" with "*writer.str++ = c;" would not add an important overhead, especially because writer is a local variable, and str is the first attribute of the structure. I hope that the machine code will be exactly the same.
History
Date User Action Args
2013-04-21 02:03:29vstinnersetrecipients: + vstinner, pitrou, r.david.murray, serhiy.storchaka
2013-04-21 02:03:28vstinnersetmessageid: <1366509808.92.0.502616719861.issue17742@psf.upfronthosting.co.za>
2013-04-21 02:03:28vstinnerlinkissue17742 messages
2013-04-21 02:03:28vstinnercreate