[issue46971] python takes long time when return big data
Mark Dickinson
report at bugs.python.org
Thu Mar 10 06:28:55 EST 2022
Mark Dickinson <dickinsm at gmail.com> added the comment:
This is expected. Your timing measures the time for garbage collection of the large arrays in addition to the time for the result to be returned.
In the line `result = myfunc()`, the name `result` gets rebound to the value of `myfunc()`. That means that `result` is unbound from whatever it was previously bound to, and the old value then gets garbage collected.
You can test this by adding a "del result" line as the last line inside the "for" loop block.
----------
nosy: +mark.dickinson
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46971>
_______________________________________
More information about the Python-bugs-list
mailing list