Fonts
Drawing text.
DejaVuSans.ttf, libstb's Font against Pillow's FreeType binding on its basic layout engine (so Pillow is not charged for shaping, which stb_truetype does not do). The two rasterize differently, so this compares speed only. stb_truetype has no security guarantee on untrusted fonts; FreeType is hardened. No speed number captures that.
open: load the font file, get a font object
On average (, the mean of each case's own ratio): 0.48×; below 1 means libstb took less time.
Time per call (lower is better)
See the numbers
| Case | libstb | Pillow | libstb / Pillow |
|---|---|---|---|
| 16px | 24.1 µs | 66.2 µs | 0.36× |
| 32px | 32.7 µs | 67.4 µs | 0.48× |
| 64px | 32.2 µs | 55.6 µs | 0.58× |
measure: how big would this text be
On average (, the mean of each case's own ratio): 0.07×; below 1 means libstb took less time.
Time per call (lower is better)
See the numbers
| Case | libstb | Pillow | libstb / Pillow |
|---|---|---|---|
| short 16px | 9.9 µs | 83.1 µs | 0.12× |
| short 32px | 9.7 µs | 84.0 µs | 0.12× |
| short 64px | 7.5 µs | 85.4 µs | 0.09× |
| paragraph 16px | 16.9 µs | 814.8 µs | 0.02× |
| paragraph 32px | 20.7 µs | 775.3 µs | 0.03× |
| paragraph 64px | 20.7 µs | 788.0 µs | 0.03× |
render: text in, coverage bitmap out (measure + allocate + draw)
On average (, the mean of each case's own ratio): 0.10×; below 1 means libstb took less time.
Time per call (lower is better)
See the numbers
| Case | libstb | Pillow | libstb / Pillow |
|---|---|---|---|
| short 16px | 35.4 µs | 277.8 µs | 0.13× |
| short 32px | 41.5 µs | 293.4 µs | 0.14× |
| short 64px | 61.6 µs | 366.1 µs | 0.17× |
| paragraph 16px | 101.9 µs | 2.57 ms | 0.04× |
| paragraph 32px | 143.7 µs | 2.91 ms | 0.05× |
| paragraph 64px | 244.5 µs | 3.70 ms | 0.07× |