Dictionary items() currently allocates each [key, value] list and its two items separately. Allocate the pair together using list_alloc_with_items(2), reducing three allocations to one per pair while preserving value references. Add a regression test covering pair mutation and shared values after the source dictionary is freed.
Before/after measurements for repeated items() calls on dictionaries with decimal string keys and Number values (median of five runs, GCC -O2; baseline 1b405bb705, patched 26ac0a447b):
| Dictionary entries | Calls per run | Before | After | Time reduction |
|---|---|---|---|---|
| 4,096 | 4,882 | 2.603719 s | 1.557332 s | 40.2% |
| 65,536 | 305 | 3.323465 s | 1.876700 s | 43.5% |
Dictionary setup is excluded from timing; replacing and freeing the previous result is included. These are focused microbenchmarks, not editor-wide speedups, and runs were not CPU-pinned.
Validation: make -C src -j4 completed without compiler warnings, all 59 tests in test_listdict.vim passed, and git diff --check passed.
https://github.com/vim/vim/pull/21384
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()