A public relations problem
A public relations problem
Posted Jul 17, 2015 11:51 UTC (Fri) by arvidma (guest, #6353)In reply to: A public relations problem by Kwi
Parent article: A better story for multi-core Python
Thanks for a very informative response!
Posted Jul 17, 2015 15:51 UTC (Fri)
by Kwi (subscriber, #59584)
[Link]
I should clarify that 99% of the time, the performance hit is insignificant, but in a tight spot, one may want to replace while ...: x.y() by: This saves a lookup of the y attribute on every iteration, in favor of a much faster local variable access (assuming this is in a function body). The Python interpreter can't do this optimization automatically, because it'd change the semantics if one thread assigned to x.y while another was in the loop. It's just one example of the performance difficulties imposed by a highly dynamic language like Python (which doesn't have C's volatile keyword). But again, 99% of the time, you care more about the language than the performance. So don't go "optimize" every bit of Python code like this. :-)
A public relations problem
z = x.y
while ...: z()