inputw: improve correctness and startup performance
authorNRK <nrk@disroot.org>
Wed, 23 Mar 2022 18:37:55 +0000 (00:37 +0600)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 25 Mar 2022 21:49:07 +0000 (22:49 +0100)
commit77526f756e23e362081ac807521f901f2e5cd5e6
tree4028e5ba2c5ad85e51fd1f17a124f0851289427b
parent7269c5355d257dd2ad2c53f15dc9c1cf6796aea5
inputw: improve correctness and startup performance

a massive amount of time inside readstdin() is spent trying to get the
max input width and then put it into inputw, only for it to get clamped
down to mw/3 inside setup().

it makes more sense to calculate inputw inside setup() once we have mw
available. similar to the last patch, i see noticeable startup
performance improvement:

before -> after
160ms  -> 60ms

additionally this will take fallback fonts into account compared to the
previous version, so it's not only more performant but also more correct.
dmenu.c