Reserve the output buffer in list2blob() using the known list length, then write validated bytes directly. This avoids repeated capacity checks and buffer growth. Add coverage for large conversions, descending ranges, and invalid trailing values.
Before/after timings for repeated conversions of a List containing repeating values 0–255 (median of five runs, GCC -O2; baseline 1b405bb705, patched cf21634360):
| List elements | Calls per run | Before | After | Time reduction |
|---|---|---|---|---|
| 4,096 | 4,882 | 103.284 ms | 85.274 ms | 17.4% |
| 65,536 | 305 | 79.751 ms | 64.278 ms | 19.4% |
Setup is excluded; replacing and freeing the previous result is included. These are focused microbenchmarks and were not CPU-pinned.
For one million valid elements, whole-process allocated memory after conversion decreased from 49.85 MB to 49.35 MB on Linux/glibc, measured with mallinfo2() (not RSS). Both versions retain Blob capacity after elements are removed.
The reservation happens before element validation, so invalid input can require unnecessary allocation and zeroing. For a million-element List with an invalid first value, 1,000 calls took 3.792 ms before and 17.546 ms after (five-run medians); both report E1239.
https://github.com/vim/vim/pull/21385
(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.![]()