Commit 32f3bd0
perf: avoid full string scans in StrEllipsis
UTF8Length and UTF8Copy walk every byte of the input, and StrEllipsis
runs for each rendered grid cell, so large TEXT/BLOB values were fully
scanned on every paint. Exit early when the byte count already proves
there is nothing to cut, and resolve the left-hand cut position with
UTF8CodepointToByteIndex, which only walks the first MaxLen codepoints.
Output is unchanged - verified against the previous implementation with
10k randomized mixed ASCII/Korean/emoji strings plus boundary cases.
Still cuts on UTF-8 codepoint boundaries.1 parent 8befce3 commit 32f3bd0
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| 538 | + | |
| 539 | + | |
538 | 540 | | |
539 | 541 | | |
540 | 542 | | |
541 | 543 | | |
542 | 544 | | |
543 | 545 | | |
544 | | - | |
| 546 | + | |
| 547 | + | |
545 | 548 | | |
546 | | - | |
547 | | - | |
548 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
549 | 558 | | |
| 559 | + | |
550 | 560 | | |
551 | 561 | | |
552 | 562 | | |
| |||
0 commit comments