[issue1407] [performance] Too many closed() checkings

Wojciech Walczak report at bugs.python.org
Thu Nov 8 21:30:33 CET 2007


New submission from Wojciech Walczak:

For debugging reasons I have added a simple line to PyObject_Call()
function in Objects/abstract.c:
printf("%s.%s\n", func->ob_type->tp_name, PyEval_GetFuncName(func));
Now, after compiling python and running interpreter with simple
print() call I receive this:

Python 3.0a1 (py3k, Nov  6 2007, 19:25:33)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print('!',end='')
builtin_function_or_method.print
method.write
function.write
function.closed
function.closed
builtin_function_or_method.ascii_encode
function.closed
function.closed
!method.write   # here it goes again for 'end' parameter
function.write
function.closed
function.closed
builtin_function_or_method.ascii_encode
function.closed
builtin_function_or_method.displayhook
>>>

Note that there can be something going on between one function.closed 
and the next one, because not every piece of code gets called by 
PyObject_Call(), but still - isn't it checking if stream is closed a 
bit too often?

Regards,
Wojtek Walczak

----------
components: Build
messages: 57275
nosy: wojtekwalczak
severity: minor
status: open
title: [performance] Too many closed() checkings
type: resource usage
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1407>
__________________________________


More information about the Python-bugs-list mailing list