![]() ![]() Width but it gives incorrect results (see ![]() The wcwidth benchmark is the libc API for codepoint In the benchmarks above ziglyph is the old API we used for codepoint To double-width without an additional conditional at runtime. So we can clamp triple-width characters (the 3-em dash) This point, and we know terminals can handle at most double-width characters We know control characters are impossible because we filter them before Situations unique to a terminal and make it even faster. To quickly look up codepoint width without taking up too much memory andīy building our own custom lookup table, we could account for special The codepoint width for every single Unicode codepoint value and Thanks to the direction of a very helpful community member, I precalculated To optimize this, and optimize this we did. Through profiling efforts, we determined that 30% of the time taken forĮvery printed character was spent calculating codepoint width. ![]() This process is surprisingly complex! See Such as A or 橋 to the terminal, it must determine how many cells Good news: we found and optimized those too, keep reading! Precomputed Lookup Tables for Codepoint Width (#1486)Ī terminal is made up of a grid of monospace cells. Than the benchmarks above due to other bottlenecks. These optimizations made cat-ing a large ASCII file 2x faster, and cat-ingĪ large Japanese file 20% faster. Text at roughly the same speed as simply reading the data into memory. This means that in bothĬases above, our SIMD pipeline is reading and parsing (in the case of UTF-8) To ensure the compiler doesn't optimize this away). Const bytes = read ( ) for (chunk of 16 bytes in bytes ) (with some annotations ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |