-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Epic rewrite #378
Open
nazmulidris
wants to merge
6
commits into
main
Choose a base branch
from
epic-rewrite
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Epic rewrite #378
+13,795
−6,817
Conversation
This file contains 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
Create 2 new crates: - script - log - support UnicodeString for output - update all calls to tracing::*() to work seamlessly with CustomEventFormatter across the entire r3bl codebase (especially r3bl_tui examples) - add of the `options: impl Into<TracingConfig>` pattern for configuring the log functionality. this is ergonomic for simple cases (for the caller) and provides sophisticated configuration possibilities due to its composability. Reorganize all the existing crates as well, to ensure that known duplicated functions are removed. Add new glyphs that are unicode character based, not emojis, so that the fg, bg color and attributes are applied in output. Emojis come with their own colors, so the fg and bg colors don't get applied. Use Vec::with_capacity wherever possible to prevent having reallocations which are expensive, and create a global size limit for the all the r3bl crates.
…ce tuning - Data oriented design: https://youtu.be/WwkuAqObplU?si=5JPiDCfAG4YQxlhG - Memory alloc: https://youtu.be/pJ-FRRB5E84?si=EGD_Tge1ApGRkT6n&t=1831 - Scalarize/flatten: https://youtu.be/Dhn-JgZaBWo?si=oFiWnwKEhfJFxZCL Refactor ch_unit.rs: - Remove `ch!` and replace it easier to understand functions that are easier to compose, and produce better compiler errors. Change the memory usage of the codebase: - Preallocate as much as possible. - Allocate on the stack when possible. - Reduce the size of fields if they don't need to store large `usize` values. Update telemetry_global_static to provide MAX FPS Implement RingBuffer and RateLimiter Add support for `$TERM_PROGRAM` equals `vscode` to enable truecolor Add TimeDuration struct to format Duration in a performant and human readable way. No memory is allocated in the Display trait implementation (the function that renders `{}`). Update all Cargo.toml to Rust edition 2024 Remove `static_global_data.rs` module. Telemetry is now handled via the `Telemetry` struct, and `RateLimiter` and `RingBuffer`. Add rendering hints to Telemetry along with the telemetry_record! macro to make the telemetry measurement ergonomic and self documenting Clean up log output to use tracing::debug!, etc. correctly with message = {message}, etc.
[ At the start ... ] This is the 2 week long refactor that is showing performance regression over the previous commit! excluding the following: - tui/md_parser/convert_to_plain_text.rs - tui/syntax_highlighting/intermediate_types.rs - tui/syntax_highlighting/md_parser_syn_hi/md_parser_syn_hi_impl.rs The files in this commit had to be rolled back as part of the changes made in the last commit were breaking all the tui tests, especially around MD parsing. These files still need the memory optimization work: - stack vs heap app - use write! instead of format! [ And then ... ] This commit brings the performance back up to previous commit with SHA: 5603296 The slow down, as far as I can tell, from running different commits side by side, is that the computation of the UnicodeString proved to be quite expensive to do every time. So it is beneficial to memoize this! Running the code with flamegraph profiling didn't really show anything useful related to this problem. Apply heap allocation techniques to the code in the following modules to boost performance and keep it stable (steady): - [x] formatter.rs - [x] editor_engine.rs - [x] convert_to_plain_text.rs - [x] intermediate_types.rs - [x] md_parser_syn_hi_impl.rs
e091ab3
to
8372ca9
Compare
Caret position can be of two kinds: - Raw - Scroll adjusted Make this explicity using the type system and provide conversions between the two. Introduce new concrete types for: - Pos - row - col - Dim - width - height - Use them in the codebase instead of ChUnit. - Use ChUnit as the "inner" type of these new concrete types.
8372ca9
to
c60209f
Compare
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.
Started with
Also ended up doing
smallvec
andsmallstr
UnicodeString
impl andUnicodeStringSegment
ChUnit
to strongly typed units for height, width, row, col, dim, and pos.Issues closed