-
Notifications
You must be signed in to change notification settings - Fork 2
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
Move border! macro here #35
Comments
I was hoping this crate would be a playground or testing ground for ideas for macros (especially if we want to write proc macros in the future), and if an idea seems interesting we could bring it to core. I suspect most people don't add an additional crate just for a macro. Is there a reason you want to bring the |
Alternatively, we can bring the |
There should be a single place for them. playground and upstream would be also fine. Compiling ratatui takes ages and splitting it up is likely a good idea. Not entirely sure about it but somehow my memory associates providing macros with added compile time on the crate that provides them. But that might only be the case for proc macros? |
My understanding is that the extra compile time for
I thought users that don't use the macro shouldn't see a difference in compile time, even if it wasn't behind a feature flag. |
I think there is a mix-up of compile time for a specific crate and total compile time. Once a crate is compiled it's not needed to compile again. The linking process is still needed tho. Everything that is published from a crate (with the given feature flags) will take time to compile the crate and will take time on linking. Moving stuff from one crate to a dependency crate results in parallel compilation. ratatui can only be compiled once all its dependencies are compiled but all the dependencies can be compiled in parallel. Meaning: moving something from ratatui to a dependency of ratatui will speed up the compilation of ratatui and the dependency can be compiled in parallel to other stuff. When ratatui would move stuff like buffer, widgets, … to their own crates it would speed up compilation as these parts can be built in parallel then. (Widgets require buffer, so there are some sequences.) The mentioned syn for example only needs to be compiled once for multiple crates using it, but all the crates using it will compile slowly as proc macros are hard to compile. Crates depending on proc macro crates can compile way faster as they only need what was published from the dependencies. So… tldr: I assume keeping it a dependency and reexport stuff in the main crate should result in faster compile times both for users of ratatui and for contributions to ratatui. |
Thanks for explaining! That makes sense. I didn't know about some of the nuances here. We should bring this up as a part of a broader discussion with the team to discuss the organization / user experience / compilation time tradeoffs etc. |
Also… I suspect the use of generics in ratatui is one of the major factors for compile time (compiling ratatui, the crates using these generics and not sure how much that affects linking directly or just by that many functions generated by these generics) Lists the generic functions: |
ratatui has a
border!
macro behind the macro feature flag. Move this macro here and remove that feature flag from ratatui.The text was updated successfully, but these errors were encountered: