Last active
March 22, 2025 01:43
-
-
Save behdad/32d027fc23f9ae24aa931e793ec96434 to your computer and use it in GitHub Desktop.
Memory usage of loading glyph outlines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export FONT_FILE=/path/to/RobotoFlex.ttf | |
git clone https://github.com/behdad/malloc-stats | |
(cd malloc-stats && make) | |
git clone https://github.com/harfbuzz/harfbuzz | |
cd harfbuzz | |
cp ../malloc-stats/malloc-stats.so . | |
meson build -Dglib=disabled -Dfreetype=enabled -Dfontations=enabled -Dbenchmark=enabled | |
ninja -C build | |
for backend in ot ft fontations; do | |
for wght in '' 400 500; do | |
cmd="build/perf/hb-draw-all $FONT_FILE $backend $wght" | |
peak=`/usr/bin/time $cmd 2>&1 | grep maxresident | sed 's/.* \([0-9]*\)maxresident.*/\1/'` | |
alloc_count=`LD_PRELOAD=$PWD/malloc-stats.so $cmd | grep '(total)' | sed 's/ */ /g' | cut -d ' ' -f 2` | |
alloc_size=`LD_PRELOAD=$PWD/malloc-stats.so $cmd | grep '(total)' | sed 's/ */ /g' | cut -d ' ' -f 3 | sed 's/,//g'` | |
echo "$FONT_FILE;$backend;$wght;$peak;$alloc_count;$alloc_size"; done; done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment