Merged
Conversation
Add grapheme segmentation and width measurement and update FlatBuffer, grid, diff and drawText to handle multi-code-point and wide glyphs. Cache layout results in the render loop to avoid redundant layout computations. Add view key-handler traversal, make Profiler use Bun's fs APIs, enable layout-engine profiling, and update tests and profiles.
Implement a stateful, incremental layout engine with a wasm bridge (init_layout_engine, update_nodes, remove_nodes, compute_layout by key) and corresponding Rust stateful implementation. Optimize renderer and buffers: track ASCII-only buffers with FlatBuffer, add ASCII fast-path diffing, avoid diffing the same buffer instance, fall back to a safe full redraw when diff output is empty, and ensure one frame is rendered on mount. Add showcase package and smoke tests (with exit timers) and include it in the test script. Misc profiler and minor test adjustments.
Introduce layoutBoundary flag to LayoutStyle and a Block.boundary() helper. Implement applyLayoutBoundaryToBlock and estimateChildLength to trim block children when a block has layoutBoundary set. Add LayoutBoundary factory and tests for trimming behavior.
Add scripts/profiler-limit.spec.ts and a "profiler:limit" npm script. Introduce WARMUP_FRAMES in profiler-core.ts. Update profiler specs to assert startup latency and steady-state metrics and call Bun.gc(true) before runs. Add clipping early-return to renderElement to skip offscreen rendering. Apply minor formatting and whitespace cleanup in layout and tests.
Add Rust toolchain and wasm-pack setup to CI and profiler workflows, and add a pnpm step to build @btuin/layout-engine (WASM). Remove the explicit pnpm version pin from the profiler workflow.
Replace CI's direct filtered command with a project build script that invokes the @btuin/layout-engine via pnpm. Update package.json build to use pnpm --filter @btuin/layout-engine build. Add "pkg" to .gitignore.
Bump oven-sh/setup-bun to v2 and pnpm/action-setup to v4 in workflow files Replace Bun.$ mkdir and Bun.write in profiler.ts with node fs mkdirSync and writeFileSync, add import and error handling. Also change profiler workflow build step to use pnpm run build
Rename test variables to UPPER_CASE, use import.meta.dirname for profile output paths, remove unused WARMUP_FRAMES, and update .gitignore to ignore nested profiles JSON. Miscellaneous style and formatting fixes (semicolons, spacing, minor console formatting).
🚀 Performance Benchmark ResultRun DetailsTriggered by commit: 015c962 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several significant improvements and new features to the project, focusing on profiling and performance benchmarking, enhancements to the layout engine, and improvements to the build and CI workflows. The most important changes are grouped and summarized below:
Profiling and Performance Benchmarking:
package.jsonfor running different types of performance tests, a new profiler integration in the application runtime (Profilerinapp.ts), and a GitHub Actions workflow (profiler.yml) that runs benchmarks on pull requests and posts results as comments. [1]], [2]], [3]], [4]], [5]], [6]], [7]], [8]], [9]], [10]], [11]])Layout Engine Enhancements:
layoutBoundaryfeature for block elements, allowing the layout engine to limit the number of child elements rendered based on available space. This includes the newapplyLayoutBoundaryToBlockandestimateChildLengthfunctions and their integration into the layout computation. [1]], [2]], [3]], [4]], [5]], [6]])resolvePaddingand dimension resolution. [1]], [2]])Build and CI Workflow Improvements:
build.yml), continuous integration (ci.yml), and performance benchmarking (profiler.yml). The CI workflow now includes linting, type checking, formatting, and tests, while the build workflow handles package builds. [1]], [2]], [3]])Codebase Simplification and Refactoring:
packages/btuin/src/index.tsby re-exporting the entire runtime module. [1]], [2]])resolvePaddingfunction inrenderer.ts. ([packages/btuin/src/layout/renderer.tsL5-L20])Rendering Optimization:
renderElement. ([packages/btuin/src/layout/renderer.tsR24-R33])These changes collectively improve the project's reliability, maintainability, and performance monitoring capabilities.