mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 16:28:19 +02:00
Benchmark unique multi-codepoint Unicode cells
Add a benchmark stream containing 262,144 distinct base-plus-combining-mark cells per repetition so TextCache collection cost remains visible instead of collapsing into cache hits. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -150,6 +150,27 @@ func unicode() (r result, err error) {
|
|||||||
return result{desc, data_sz, duration, reps}, nil
|
return result{desc, data_sz, duration, reps}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func unique_unicode() (r result, err error) {
|
||||||
|
const cell_count = 256 * 1024
|
||||||
|
const combining_count = 0x70
|
||||||
|
var data strings.Builder
|
||||||
|
data.Grow(cell_count * 10)
|
||||||
|
for i := range cell_count {
|
||||||
|
q := i
|
||||||
|
data.WriteByte('a')
|
||||||
|
for range 3 {
|
||||||
|
data.WriteRune(rune(0x300 + q%combining_count))
|
||||||
|
q /= combining_count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const desc = "Unique multi-codepoint Unicode cells"
|
||||||
|
duration, data_sz, reps, err := benchmark_data(desc, data.String(), opts)
|
||||||
|
if err != nil {
|
||||||
|
return result{}, err
|
||||||
|
}
|
||||||
|
return result{desc, data_sz, duration, reps}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func ascii_with_csi() (r result, err error) {
|
func ascii_with_csi() (r result, err error) {
|
||||||
const sz = 1024*1024 + 17
|
const sz = 1024*1024 + 17
|
||||||
out := make([]byte, 0, sz+48)
|
out := make([]byte, 0, sz+48)
|
||||||
@@ -244,7 +265,7 @@ func present_result(r result, col_width int) {
|
|||||||
|
|
||||||
func all_benchamrks() []string {
|
func all_benchamrks() []string {
|
||||||
return []string{
|
return []string{
|
||||||
"ascii", "unicode", "csi", "images", "long_escape_codes",
|
"ascii", "unicode", "unique_unicode", "csi", "images", "long_escape_codes",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +297,13 @@ func main(args []string) (err error) {
|
|||||||
results = append(results, r)
|
results = append(results, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if slices.Index(args, "unique_unicode") >= 0 {
|
||||||
|
if r, err = unique_unicode(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
results = append(results, r)
|
||||||
|
}
|
||||||
|
|
||||||
if slices.Index(args, "csi") >= 0 {
|
if slices.Index(args, "csi") >= 0 {
|
||||||
if r, err = ascii_with_csi(); err != nil {
|
if r, err = ascii_with_csi(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user