[hackers] Re: [dmenu][patch] Improve speed of drw_text when provided with large strings
On Sat, Aug 7, 2021, at 9:34 PM, m_AT_milesalan.com wrote:
> - for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
> - drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
> + if (ew > w)
> + for (ew = 0, len = 0; ew < w - lpad * 2 && len < MIN(utf8strlen,
> sizeof(buf) - 1); len++)
> + drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
> + else
> + len = MIN(utf8strlen, sizeof(buf) - 1);
To test, try selecting previous/next items with the following (adjust -c as needed):
for i in $(seq 20); do
cat /dev/urandom | base64 | tr -d '\n' | head -c 1000000
done | ./dmenu -l 10
Received on Sun Aug 08 2021 - 03:39:44 CEST
This archive was generated by hypermail 2.3.0
: Sun Aug 08 2021 - 03:48:31 CEST