- changed status to resolved
Faster metadata support
I'm working on speeding up our metadata support ("manually" loading information about constants, variables, functions and special methods).
Two major todo's w.r.t. that:
Add the new init.py code to framework wrappers other than
pyobjc-framework-Cocoa
Implement the "old" init support functions on top of the new
ones to ensure that we don't break wrappers created by third parties
Comments (5)
-
-
Ronald, all I can find on this subject are these docs: http://pythonhosted.org/pyobjc/metadata/compiled.html and a few sporadic examples, such as this one: http://goo.gl/pLhr5. I don't understand how developers are supposed to use this.
I have a very simple utility, and it's suffering from slow load times. A lazy loader would be very useful. I'm almost on the verge of rewriting in native Obj-C.
Thanks for any help. - Boris (boris@smus.com)
-
The lazy loader should be transparent if you use PyObjC's framework wrappers, and needs work if you want to wrap other frameworks. The currently is no documentation on how to create compiled wrappers, that's high on my TODO list.
If you are only using framework wrappers: make sure you do not use "from Foundation import ", use "import Foundation" or "from Foundation import NSObject" instead. Someone recently noticed that the "from ... import " form is currently much slower than it used to be, due to the way the PyObjC lazy loader is implemented. I'm working on a fix for that, but even with the fix explicit imports will be better because they perform less form (because explicit imports don't have to resolve the symbols you don't use).
-
Thanks Ronald! I discovered last night that using
from Framework import NSSymbol
addresses the performance issue. https://twitter.com/borismus/status/357029358155735040Too bad, because of most the online sample code (and even the Python-Cocoa templates) uses
from Framework import *
. I was very close to jumping ship. -
hi,
We just changed in our 360 files of pyobjc code. The from Foundation import * to import Foundation (and called then Foundation.NSObject). Same think for AppKit, WebKit, AddressBook.
Our app now opens in less then 1 second, instead of 8 seconds.
Before we were using PyObjc 2.2 and load time was about 2 seconds.
best
Marc
- Log in to comment