Commit a05543b
committed
perf(render): fix lazy-render and fold performance for large sessions
- Replace cursor+zc fold creation with :{from},{to}fold Ex commands
— avoids cursor-triggered screen redraws (~90ms/fold in large buffers)
- Switch to foldmethod=manual and stay there — prevents foldexpr
recalculation on every buffer line (~4.6s on 87K lines)
- Lazy-render only viewport-sized message count on initial load
- Load more messages on scroll-to-top via WinScrolled autocmd
- Fix lazy_render_count being cleared by M.reset() — read before reset,
persist back to ctx after determining limit
- Debounce WinScrolled load_more callback (150ms) to prevent rapid
re-renders during fast scrolling
- Remove debug vim.notify logging from render paths
Performance: ~36s → ~10ms render time on a 2786-msg/87K-line session.
Closes #3921 parent 3798e7f commit a05543b
4 files changed
Lines changed: 295 additions & 11 deletions
File tree
- lua/opencode/ui
- renderer
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | 407 | | |
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
418 | 416 | | |
419 | | - | |
420 | | - | |
421 | | - | |
| 417 | + | |
| 418 | + | |
422 | 419 | | |
423 | 420 | | |
424 | 421 | | |
425 | 422 | | |
426 | 423 | | |
427 | | - | |
428 | | - | |
| 424 | + | |
429 | 425 | | |
430 | 426 | | |
431 | 427 | | |
| 428 | + | |
432 | 429 | | |
433 | 430 | | |
434 | 431 | | |
| |||
692 | 689 | | |
693 | 690 | | |
694 | 691 | | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
695 | 699 | | |
696 | 700 | | |
697 | 701 | | |
698 | 702 | | |
699 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
700 | 708 | | |
701 | 709 | | |
702 | 710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
15 | 34 | | |
16 | 35 | | |
17 | 36 | | |
| |||
319 | 338 | | |
320 | 339 | | |
321 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
322 | 344 | | |
323 | 345 | | |
324 | 346 | | |
| |||
329 | 351 | | |
330 | 352 | | |
331 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
332 | 370 | | |
333 | 371 | | |
334 | 372 | | |
| |||
376 | 414 | | |
377 | 415 | | |
378 | 416 | | |
| 417 | + | |
379 | 418 | | |
380 | 419 | | |
| 420 | + | |
381 | 421 | | |
382 | 422 | | |
383 | 423 | | |
| |||
399 | 439 | | |
400 | 440 | | |
401 | 441 | | |
| 442 | + | |
402 | 443 | | |
403 | 444 | | |
404 | 445 | | |
| |||
407 | 448 | | |
408 | 449 | | |
409 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
410 | 473 | | |
411 | 474 | | |
412 | 475 | | |
| |||
416 | 479 | | |
417 | 480 | | |
418 | 481 | | |
| 482 | + | |
419 | 483 | | |
420 | 484 | | |
421 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
0 commit comments