This is an archive of the discontinued LLVM Phabricator instance.

Speedup some unicode rendering
ClosedPublic

Authored by serge-sans-paille on Nov 26 2020, 7:21 AM.

Details

Summary

Use a short path for column width computation for ascii characters. Especially relevant for llvm-objdump.

before:

% time ./bin/llvm-objdump -D  -j .text /lib/libc.so.6 >/dev/null
./bin/llvm-objdump -D -j .text /lib/libc.so.6 > /dev/null  0.75s user 0.01s system 99% cpu 0.757 total

after:

% time ./bin/llvm-objdump -D  -j .text /lib/libc.so.6 >/dev/null
./bin/llvm-objdump -D -j .text /lib/libc.so.6 > /dev/null  0.37s user 0.01s system 99% cpu 0.378 total

Diff Detail

Event Timeline

serge-sans-paille requested review of this revision.Nov 26 2020, 7:21 AM
aguinet added inline comments.Nov 28 2020, 11:08 AM
llvm/lib/Support/Unicode.cpp
352

According to isprint man page, the result depends on the current locale. Is this the behavior we want? Maybe checking for the printable ASCII character range "by hand" would make this code more portable?

llvm/lib/Support/Unicode.cpp
352

correct, I'll add that.

Make the ascii test for isprintable locale-independent

aguinet accepted this revision.Dec 2 2020, 6:55 AM
This revision is now accepted and ready to land.Dec 2 2020, 6:55 AM
aguinet accepted this revision.Dec 3 2020, 6:37 AM
This revision was automatically updated to reflect the committed changes.