googlefonts / googlefonts/fontmake
Some profiling findings
- Dominant language
- Python
- Stars
- 888
- Forks
- 97
- Avg merge
- 4d 52m
- Merged PRs (30d)
- 1
Description
I found https://github.com/nvdv/vprof and ran it on two scripts.
Script 1 with booleanOperations (Cantarell from https://gitlab.gnome.org/GNOME/cantarell-fonts/tree/b3a2f068612933765af7696f46c3c2d544d5d3f9/src):
```Python
import ufoLib2
import ufo2ft
u = ufoLib2.Font.open("Cantarell-Regular.ufo")
f = ufo2ft.compileOTF(u, inplace=True, removeOverlaps=True)
f.save("a.otf")
```
Script 2 with skia-pathops:
```Python
import ufoLib2
import ufo2ft
u = ufoLib2.Font.open("Cantarell-Regular.ufo")
f = ufo2ft.compileOTF(u, inplace=True, removeOverlaps=True, overlapsBackend="pathops")
f.save("a.otf")
```
1. On my Fedora 31 x64 with Python 3.7.5, Ryzen 1700, pathops speeds up the runtime from 10s (bOps) to ~7.6s (pathops).
2. booleanOperations spends A LOT of time in `convertPointsToSegment`

3. pathops presents a more even flame graph:

4. Memory usage: a lot of `Point`s. Quite a few `Glyph`s and `Anchor`s:

5. In the code heatmap, `logging` and `re` saw a lot of action for some reason:

Contributor guide
Research direction
Start by reproducing the two profiling runs through ufo2ft.compileOTF with removeOverlaps enabled, comparing the default booleanOperations backend with overlapsBackend="pathops". Review the reported time in booleanOperations.convertPointsToSegment and the observed Point, Glyph, Anchor, logging, and re activity; the issue does not define a specific optimization or acceptance criterion, so scope must be clarified before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100