stevengj/PyCall.jl — pull request #28 by simonster (2013-07-18 21:41:40+00:00)
Title: RFC: Use modules for pyimport

This seems to be >20X faster than constructing types. After warm-up:

```
# Current approach
julia> @time for i = 1:10; pywrap(pyimport("numpy")); end
elapsed time: 14.848519913 seconds (285308000 bytes allocated)

# Anon module approach
julia> @time for i = 1:10; pywrap_module(pyimport("numpy")); end
elapsed time: 0.625061259 seconds (22389056 bytes allocated)
```

Unfortunately, this will break some existing code, since the modules have no `getindex` method. Instead, I created a function `pysym` that allows lookup of members by name. I've left around the old `pywrap` function for cases where the old behavior is desirable.