#2773 HIGH Trial-3: Some sugar modules are running code on import causing hard to debug performance issues
Zarro Boogs per Child
bugtracker at laptop.org
Tue Aug 14 05:08:01 EDT 2007
#2773: Some sugar modules are running code on import causing hard to debug
performance issues
---------------------+------------------------------------------------------
Reporter: J5 | Owner: tomeu
Type: defect | Status: new
Priority: high | Milestone: Trial-3
Component: sugar | Version:
Resolution: | Keywords: review+
Verified: 0 |
---------------------+------------------------------------------------------
Changes (by tomeu):
* keywords: review? => review+
Comment:
Replying to [comment:4 marco]:
> Replying to [ticket:2773 J5]:
> > Some of the sugar python files run code outside of functions and
classes which is run every time the module is imported.
>
> Hmmm http://docs.python.org/tut/node8.html
>
> "A module can contain executable statements as well as function
definitions. These statements are intended to initialize the module. They
are executed only the first time the module is imported somewhere."
>
> And the test-import testcase which I attached seem to confirm it.
>
> What am I missing?
Don't know if this is what J5 meant to say, but in my opinion doing
expensive things on the module scope is bad because we are delaying start
time and, in some cases, increasing memory usage for things that perhaps
we are not going to use.
So I think Dan's patch is good, please push it.
--
Ticket URL: <https://dev.laptop.org/ticket/2773#comment:6>
One Laptop Per Child <http://laptop.org/>
More information about the Bugs
mailing list