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 Arfrever, amaury.forgeotdarc, brett.cannon, lemburg, loewis, pitrou, vstinner
Date 2010-09-24.12:40:37
SpamBayes Score 0.0001732209
Marked as misclassified No
Message-id <201009241440.31182.victor.stinner@haypocalc.com>
In-reply-to <1285330441.53.0.858438290271.issue9630@psf.upfronthosting.co.za>
Content
> Some things about your patch:
> - as Amaury said, functions should be named "redecode*"
> rather than "reencode*" 

Yes, as written before (msg117269), I will do it in my next patch.

> - please use -1 for error return, not 1

Ok.

> - have you tried to measure if it made Python startup slower?

(Sploiter: the overhead is around 3%)

First, my patch doesn't concern Windows or Mac OS X, because the filesystem 
encoding is hardcoded in these platforms. Then, it only concerns systems with 
a filesystem encoding different than utf-8. utf-8 is now the default encoding of 
all Linux distributions. I suppose that BSD systems do also use it by default.

Let's try a dummy benchmark with py3k r84990. 5 runs, I kept the smallest 
time.

-- pydebug mode (gcc -O0) with the patch ---

$ unset PYTHONFSENCODING; time ./python  -c "pass"
real    0m0.084s
user    0m0.080s
sys     0m0.010s

$ export PYTHONFSENCODING=ascii; time ./python  -c "pass"
real    0m0.100s
user    0m0.100s
sys     0m0.000s

The startup time overhead is around 20%.

-- default mode (gcc -O3) without the patch ---

$ unset PYTHONFSENCODING; time ./python  -c "pass"

real    0m0.033s
user    0m0.030s
sys     0m0.000s

-- default mode (gcc -O3) with the patch ---

$ export PYTHONFSENCODING=utf-8; time ./python  -c "pass"

real    0m0.032s
user    0m0.030s
sys     0m0.000s

$ export PYTHONFSENCODING=ascii; time ./python  -c "pass"

real    0m0.033s
user    0m0.020s
sys     0m0.020s

Here is overhead is around 3%.
History
Date User Action Args
2010-09-24 12:40:40vstinnersetrecipients: + vstinner, lemburg, loewis, brett.cannon, amaury.forgeotdarc, pitrou, Arfrever
2010-09-24 12:40:39vstinnerlinkissue9630 messages
2010-09-24 12:40:37vstinnercreate