defcon
defcon copied to clipboard
Optimize
This is a general issue for ideas on optimizing the overall speed of the objects.
FWIW defcon master if almost as fast as robofab. It's the ufo3 branch of defcon that is twice slower.
Can we merge ufo3 branch first, then start optimization work?
Yeah, let's do the switch. This has made me nervous for years, but I guess it is time. I'll try to start the process right now.
Done. Yikes, I hope I did that correctly. I'll delete the ufo3 branch in a few days after I feel a little more confident that I didn't break everything.
What can I do to facilitate some optimization experimentation? Would a "optimize" branch be useful?
cc @adrientetar @typemytype @anthrotype @moyogo @jamesgk
For me I just need to know which branch to spend my time on :). A local benchmark, as well as a strong test suite help. Not much else needed really. Thanks!
Cool! The same merge could be done for extractor and fontMath, I think.
Cool! The same merge could be done for extractor and fontMath, I think.
Yeah. There are a lot of others. Let me make sure my strategy worked and then I'll merge those. I started this ufo3 branch five years ago and I've been dreading this moment since then. I am literally shaking. There were so many changes.
Awesome!
https://travis-ci.org/typesupply/defcon and https://ci.appveyor.com/project/typesupply/defcon look good.
It all will be okay! Let's not go for a 5-year UFO-4 then. Gradual improvements FTW...
+1 for also merging fontMath/ufo3
branch.
It's the last of fontmake's requirements in a branch different from master
.
+1 for also merging fontMath/ufo3 branch.
Done.
Thanks! 👍
All of my repositories should be switched to ufo3 now.
Uh... we got a little off track here!
Back on the topic of optimization, I noticed a pretty deep nesting of notification-related calls when I ctrl-C'd fontmake today:
Traceback (most recent call last):
File "/usr/local/bin/fontmake", line 9, in <module>
load_entry_point('fontmake', 'console_scripts', 'fontmake')()
File "/home/jamesgk/code/fontmake/Lib/fontmake/__main__.py", line 89, in main
project.run_from_glyphs(glyphs_path, **args)
File "/home/jamesgk/code/fontmake/Lib/fontmake/font_project.py", line 275, in run_from_glyphs
glyphs_file, interpolate, masters_as_instances, family_name)
File "/home/jamesgk/code/fonttools/Lib/fontTools/misc/loggingTools.py", line 372, in wrapper
return func(*args, **kwds)
File "/home/jamesgk/code/fontmake/Lib/fontmake/font_project.py", line 92, in build_ufos
glyphs_path, master_dir, instance_dir, family_name=family_name))
File "/home/jamesgk/code/glyphsLib/Lib/glyphsLib/__init__.py", line 100, in build_instances
filename, include_instances=True, family_name=family_name)
File "/home/jamesgk/code/glyphsLib/Lib/glyphsLib/__init__.py", line 63, in load_to_ufos
family_name=family_name, debug=debug)
File "/home/jamesgk/code/glyphsLib/Lib/glyphsLib/builder.py", line 142, in to_ufos
load_glyph(glyph, layer, glyph_data)
File "/home/jamesgk/code/glyphsLib/Lib/glyphsLib/builder.py", line 610, in load_glyph
draw_paths(pen, layer.get('paths', []))
File "/home/jamesgk/code/glyphsLib/Lib/glyphsLib/builder.py", line 628, in draw_paths
pen.endPath()
File "/home/jamesgk/code/defcon/Lib/defcon/pens/glyphObjectPointPen.py", line 21, in endPath
self._glyph.appendContour(self._contour)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/glyph.py", line 548, in appendContour
self.insertContour(len(self), contour)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/glyph.py", line 575, in insertContour
self.postNotification(notification="Glyph.ContoursChanged")
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 198, in postNotification
callback(notificationObj)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/component.py", line 386, in baseGlyphDataChangedNotificationCallback
self.postNotification("Component.BaseGlyphDataChanged")
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 198, in postNotification
callback(notificationObj)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/glyph.py", line 1235, in _componentBaseGlyphDataChanged
self.postNotification(notification="Glyph.ComponentsChanged")
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 198, in postNotification
callback(notificationObj)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/component.py", line 386, in baseGlyphDataChangedNotificationCallback
self.postNotification("Component.BaseGlyphDataChanged")
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 198, in postNotification
callback(notificationObj)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/glyph.py", line 1236, in _componentBaseGlyphDataChanged
self.postNotification(notification=self.changeNotificationName)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 198, in postNotification
callback(notificationObj)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/layer.py", line 738, in _glyphDirtyStateChange
self.dirty = True
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 413, in _set_dirty
self.postNotification(self.changeNotificationName)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 198, in postNotification
callback(notificationObj)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/layerSet.py", line 352, in _layerDirtyStateChange
self.dirty = True
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 413, in _set_dirty
self.postNotification(self.changeNotificationName)
File "/home/jamesgk/code/defcon/Lib/defcon/objects/base.py", line 222, in postNotification
dispatcher.postNotification(notification=notification, observable=self, data=data)
File "/home/jamesgk/code/defcon/Lib/defcon/tools/notifications.py", line 154, in postNotification
if key not in self._registry:
KeyboardInterrupt
Over half of the stack trace is devoted wholly to notifications! Just thought this was interesting and wanted to leave it here for reference.