-
Notifications
You must be signed in to change notification settings - Fork 51
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
Do less #674
Do less #674
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
can you fix the lint failure before merge?
Also can you tell us what the speed savings are for an average font?
|
||
If minimal is True, it is assumed that the UFOs will only be used in | ||
font production, and unnecessary steps (e.g. converting background layers) | ||
will be skipped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe list exactly what is dropped
import glyphsLib
from timeit import timeit
def convert_minimal():
glyphsLib.load_to_ufos("SofiaSans-VF-New.glyphs", minimal=True)
def convert_maximal():
glyphsLib.load_to_ufos("SofiaSans-VF-New.glyphs", minimal=False)
minimal = timeit(convert_minimal, number=15)
maximal = timeit(convert_maximal, number=15)
print("minimal=True: %f" % minimal)
print("minimal=False: %f" % maximal)
Yes, that's right. Avoiding running unnecessary code takes 54% longer. I don't understand it either. |
Looks like it's caching/data locality issues with the parser. Here's another test: import glyphsLib
from timeit import timeit
parsed = glyphsLib.GSFont("SofiaSans-VF-New.glyphs")
def convert_minimal():
glyphsLib.to_ufos(parsed, minimal=True)
def convert_maximal():
glyphsLib.to_ufos(parsed, minimal=False)
maximal = timeit(convert_maximal, number=10)
minimal = timeit(convert_minimal, number=10)
print("minimal=True: %f" % minimal)
print("minimal=False: %f" % maximal)
# Try other order, just to make sure.
minimal = timeit(convert_minimal, number=10)
maximal = timeit(convert_maximal, number=10)
print("minimal=True: %f" % minimal)
print("minimal=False: %f" % maximal)
So what - 5% faster generating UFOs? |
I'd like to get this merged, but it's kind of a breaking change. For the majority use case (building fonts), it makes things faster and it also avoids certain stupid bugs: I have a build failing because there's a background glyph with a non-existent component - which shouldn't make any difference to the build process, but means that complete UFOs can't be generated, which stops everything dead. But for the glyphs<->UFO<->glyphs workflow, changing the default to be "minimal=True" might muck things up. So I would like to check with @belluzj and @madig before merging. (An obvious alternative is that we set default to "minimal=False" and turn on "minimal=True" in build systems. Yeah, that's clearly better...) |
I believe that's preferable |
929852b
to
aa2cdf3
Compare
LGTM thanks |
This skips over steps which are not necessary for font conversion when generating UFO files. See #673