Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip down __init__.py so importing pyczmq is much faster #19

Merged
merged 2 commits into from
Jan 17, 2014
Merged

strip down __init__.py so importing pyczmq is much faster #19

merged 2 commits into from
Jan 17, 2014

Conversation

gward
Copy link
Contributor

@gward gward commented Jan 16, 2014

No description provided.

The basic "import pyczmq" goes from ~1.2 sec to 0.03 sec. Of course
that's not very realistic, since no one wants just the empty package.

A more realistic example: "from pyczmq import zmq" is now 0.36 sec
(from 1.2 sec). And "from pyczmq import zmq, zctx, zsocket" is now
0.53 sec.

This is also more in keeping with generally accepted practice in the
Python community (at least as I read things).

The catch is that this can break existing imports. Specifically, any
code like this:

  import pyczmq

  ctx = pyczmq.zctx.new()
  socket = pyczmq.zsocket.new(...)

WILL BREAK. The single import will have to be replaced by

  import pyczmq.zctx
  import pyczmq.zsocket

(or "from pyczmq import zctx, zsocket" if you don't mind changing your
code too).
@michelp
Copy link
Contributor

michelp commented Jan 16, 2014

I'm ok with this change but I'd like to hear from @claws and @mhaberler to make sure it's ok with them.

Also it looks like the Travis CI tests are breaking on this branch, do they pass for @gward?

@mhaberler
Copy link
Member

fine with me - go ahead

I did notice the somewhat lengthy startup but didnt bother. Hey, it could be worse - just think of firing off a Java app ;)

@claws
Copy link
Member

claws commented Jan 17, 2014

I am fine with the change so long as the tests still pass.

The Travis builds appeared to be breaking for unrelated reasons (czmq test,
libzmq) that I can't repeat.
On Jan 17, 2014 9:56 AM, "Michel Pelletier" notifications@github.com
wrote:

I'm ok with this change but I'd like to hear from @clawshttps://github.com/clawsand
@mhaberler https://github.com/mhaberler to make sure it's ok with them.

Also it looks like the Travis CI tests are breaking on this branch, do
they pass for @gward https://github.com/gward?


Reply to this email directly or view it on GitHubhttps://github.com//pull/19#issuecomment-32564353
.

michelp added a commit that referenced this pull request Jan 17, 2014
strip down __init__.py so importing pyczmq is much faster
@michelp michelp merged commit 8ad9d50 into zeromq:master Jan 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants