Repository navigation
Commit 7b0e7a2
committed
stream: avoid allocations on every stream/iter push() write
Every write() to a push() or broadcast() writer converted its options
with the WriteOptions dictionary converter to look for a signal, which
creates an empty dictionary when there are no options, and every write
replaced the array of pending drains, even when there were none.
Return no signal for undefined or null options without converting them,
and leave the array of pending drains alone when it is empty. Writing
16-byte chunks to a push() stream with await write() and reading them
is about 30% faster, and about 18% faster when piping them; 64 KiB
chunks are about 11% faster.
Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>1 parent dea0e3e commit 7b0e7a2
3 files changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
839 | 839 | | |
840 | 840 | | |
841 | 841 | | |
| 842 | + | |
842 | 843 | | |
843 | 844 | | |
844 | 845 | | |
| |||
847 | 848 | | |
848 | 849 | | |
849 | 850 | | |
| 851 | + | |
850 | 852 | | |
851 | 853 | | |
852 | 854 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| |||
602 | 603 | | |
603 | 604 | | |
604 | 605 | | |
| 606 | + | |
605 | 607 | | |
606 | 608 | | |
607 | 609 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
710 | 713 | | |
711 | 714 | | |
712 | 715 | | |
| |||
0 commit comments