[PR #673] [MERGED] introduce native-span-feed output stream #701

Closed
opened 2026-03-02 23:47:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/673
Author: @kommander
Created: 2/11/2026
Status: Merged
Merged: 2/12/2026
Merged by: @kommander

Base: mainHead: introduce-output-stream


📝 Commits (10+)

📊 Changes

29 files changed (+7516 additions, -4 deletions)

View changed files

📝 packages/core/README.md (+4 -0)
📝 packages/core/package.json (+2 -1)
packages/core/src/NativeSpanFeed.ts (+300 -0)
packages/core/src/benchmark/.gitignore (+7 -0)
packages/core/src/benchmark/latest-all-bench-run.json (+707 -0)
packages/core/src/benchmark/latest-async-bench-run.json (+336 -0)
packages/core/src/benchmark/latest-default-bench-run.json (+657 -0)
packages/core/src/benchmark/latest-large-bench-run.json (+707 -0)
packages/core/src/benchmark/latest-quick-bench-run.json (+207 -0)
packages/core/src/benchmark/native-span-feed-async-benchmark.ts (+355 -0)
packages/core/src/benchmark/native-span-feed-benchmark.md (+56 -0)
packages/core/src/benchmark/native-span-feed-benchmark.ts (+596 -0)
packages/core/src/benchmark/native-span-feed-compare.ts (+280 -0)
📝 packages/core/src/index.ts (+1 -0)
📝 packages/core/src/testing/mock-keys.test.ts (+2 -1)
packages/core/src/tests/native-span-feed-async.test.ts (+173 -0)
packages/core/src/tests/native-span-feed-close.test.ts (+120 -0)
packages/core/src/tests/native-span-feed-coverage.test.ts (+227 -0)
packages/core/src/tests/native-span-feed-edge-cases.test.ts (+352 -0)
packages/core/src/tests/native-span-feed-use-after-free.test.ts (+45 -0)

...and 9 more files

📄 Description

Introduces a stream implementation, to feed data efficiently from native/zig to bun/typescript, using spans of memory in a chunked ring buffer, allowing full zero-copy consumption through to typescript, with and async event interface.

Intentionally named NativeSpanFeed to not be confused with a node ReadStream interface. A ReadStream interface is not possible without copy, but the feed is intentionally zero-copy to not cause GC pressure in Bun.

Not actively used in the renderer yet. It will allow to stream all ANSI output to actual WritableStreams in Bun.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/673 **Author:** [@kommander](https://github.com/kommander) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `introduce-output-stream` --- ### 📝 Commits (10+) - [`34c1aeb`](https://github.com/anomalyco/opentui/commit/34c1aeba0c416b24b913ae107269812e8346fc86) integrate - [`72cebef`](https://github.com/anomalyco/opentui/commit/72cebef98f9ae46cad1c68a2b8dbc9b4391f6ccd) benchmark - [`891fc12`](https://github.com/anomalyco/opentui/commit/891fc127de3d4231efd8f205922ca321e153957a) update baseline - [`fed92d2`](https://github.com/anomalyco/opentui/commit/fed92d2f578d0c73f6a827153c2dfe65bac80687) update baseline properly - [`608af13`](https://github.com/anomalyco/opentui/commit/608af1350895c15db2e2381725bde1defbf6220d) docs - [`f963bac`](https://github.com/anomalyco/opentui/commit/f963bac4befbdadd0d4e3f244b0da8ec9592341f) move tests - [`c509cd5`](https://github.com/anomalyco/opentui/commit/c509cd53cb91b11c2bae9e2bf5812c02c89f3f37) cover reentrance - [`92eb8b3`](https://github.com/anomalyco/opentui/commit/92eb8b35cfe93f02187eca9c7fe7ce1f043abf20) use gpa - [`725a068`](https://github.com/anomalyco/opentui/commit/725a0684d5137b8e344da406cbd3d18b177b4c3d) prettier - [`ca262d0`](https://github.com/anomalyco/opentui/commit/ca262d0cf095903a9ad2465cca62d8c9717785af) shared callback ### 📊 Changes **29 files changed** (+7516 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/README.md` (+4 -0) 📝 `packages/core/package.json` (+2 -1) ➕ `packages/core/src/NativeSpanFeed.ts` (+300 -0) ➕ `packages/core/src/benchmark/.gitignore` (+7 -0) ➕ `packages/core/src/benchmark/latest-all-bench-run.json` (+707 -0) ➕ `packages/core/src/benchmark/latest-async-bench-run.json` (+336 -0) ➕ `packages/core/src/benchmark/latest-default-bench-run.json` (+657 -0) ➕ `packages/core/src/benchmark/latest-large-bench-run.json` (+707 -0) ➕ `packages/core/src/benchmark/latest-quick-bench-run.json` (+207 -0) ➕ `packages/core/src/benchmark/native-span-feed-async-benchmark.ts` (+355 -0) ➕ `packages/core/src/benchmark/native-span-feed-benchmark.md` (+56 -0) ➕ `packages/core/src/benchmark/native-span-feed-benchmark.ts` (+596 -0) ➕ `packages/core/src/benchmark/native-span-feed-compare.ts` (+280 -0) 📝 `packages/core/src/index.ts` (+1 -0) 📝 `packages/core/src/testing/mock-keys.test.ts` (+2 -1) ➕ `packages/core/src/tests/native-span-feed-async.test.ts` (+173 -0) ➕ `packages/core/src/tests/native-span-feed-close.test.ts` (+120 -0) ➕ `packages/core/src/tests/native-span-feed-coverage.test.ts` (+227 -0) ➕ `packages/core/src/tests/native-span-feed-edge-cases.test.ts` (+352 -0) ➕ `packages/core/src/tests/native-span-feed-use-after-free.test.ts` (+45 -0) _...and 9 more files_ </details> ### 📄 Description Introduces a stream implementation, to feed data efficiently from native/zig to bun/typescript, using spans of memory in a chunked ring buffer, allowing full zero-copy consumption through to typescript, with and async event interface. Intentionally named `NativeSpanFeed` to not be confused with a node ReadStream interface. A ReadStream interface is not possible without copy, but the feed is intentionally zero-copy to not cause GC pressure in Bun. Not actively used in the renderer yet. It will allow to stream all ANSI output to actual WritableStreams in Bun. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:47:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#701
No description provided.