Re: [vim/vim] u_read_undo(): use a sorted table to swizzle sequence numbers (PR #20942)
Samuel Schlesinger (Vim Github Repository) <[email protected]> Sun, 09 Aug 2026 14:59:18 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/20942/[email protected]> |
SamuelSchlesinger left a comment (vim/vim#20942) Thanks for the thorough review. I force-pushed a rework that takes your in-place sort alternative. The parallel table is gone and with it the zero-header bug, and qsort() is guarded with num_head > 0. There is a regression test for the zero-header file now, it fails on the previous version of this patch and passes on master. One catch: the test has to create the file with writefile() before setting 'undolevels' to -1, otherwise the buffer has already collected headers. The test and style points should all be addressed: CheckFeature, byte asserts before patching (the headers are indeed oldest-first with seqs 1 and 2), defer cleanup, explicit macro argument, braces, and a single squashed commit with the cost model. Re-benchmarked at 1.49s -> 0.11s on current master. The branches test now compares undotree().entries directly instead of the seq/alt projection, since every field round-trips exactly. While in there I also made old_idx/new_idx/cur_idx int, since as short they truncate above 32767 headers, which is exactly the regime this patch is about. The owner-differs early return also leaks the file name from u_get_undo_file_name(); that is independent of this change, sent as #20987. -- Reply to this email directly or view it on GitHub: https://github.com/vim/vim/pull/20942#issuecomment-5234050433 You are receiving this because you are subscribed to this thread. Message ID: <vim/vim/pull/20942/[email protected]> -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20942/c5234050433%40github.com.