]> granicus.if.org Git - procps-ng/commit
top: an efficiency tweak to extra wide character logic
authorJim Warner <james.warner@comcast.net>
Tue, 23 Jan 2018 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@enc.com.au>
Mon, 19 Feb 2018 09:37:24 +0000 (20:37 +1100)
commit3b53aba319f3cc6e26dd428b898d030b3a1c1a07
treece7d46bd935b8de667824bedef0def52b1c1d9f8
parent2167dcbccb86a8ee55a00ecb5de08f6461ac296b
top: an efficiency tweak to extra wide character logic

When I recently added extra wide character support for
locales like zh_CN, I didn't worry about some overhead
associated with the new calls to 'mbtowc' & 'wcwidth'.
That's because such overhead was usually incurred with
user interactions, not a normal iterative top display.

There was, however, one area where this overhead would
impact the normal iterative top mode - that's with the
Summary display. So I peeked at the glibc source code.

As it turns out, the costs of executing those 'mbtowc'
and 'wcwidth' functions were not at all insignificant.
So, this patch will avoid them in the vast majority of
instances, while still enabling extra wide characters.

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c