STINNER Victor added the comment:

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.

----------
Added file: http://bugs.python.org/file29961/bytes_writer-3.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17742>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to