Reexamining Python 3 Text I/O. Python 3.1’s IO performance is a huge improvement over 3.0, but still considerably slower than 2.6. It turns out it’s all to do with Python 3’s unicode support: When you read a file in to a string, you’re asking Python to decode the bytes in to UTF-8 (the new default encoding) at the same time. If you open the file in binary mode Python 3 will read raw bytes in to a bytestring instead, avoiding the conversion overhead and performing only 4% slower than the equivalent code in Python 2.6.4.
Daniel - 7th September 2011 14:33 - #
danish - 5th October 2011 12:01 - #
ugg pas cher - 29th October 2011 03:05 - #
Groundless - 1st November 2011 06:45 - #
ken - 3rd November 2011 06:48 - #
kentas - 3rd November 2011 06:49 - #
sa - 3rd November 2011 06:51 - #
sa - 3rd November 2011 06:53 - #