Skip to content
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

rust: declare generated functions as inline able #1093

Open
crop2000 opened this issue Dec 10, 2024 · 3 comments
Open

rust: declare generated functions as inline able #1093

crop2000 opened this issue Dec 10, 2024 · 3 comments

Comments

@crop2000
Copy link
Contributor

I think it should make sense to add a #[inline] declaration to most functions generated by faust.
here a example how the generated code would look like:
example

The main benefit of explicit inline declaration is that functions can be in-lined across crate boundaries.

there are some things to consider in relation to this as discussed here:
https://matklad.github.io/2021/07/09/inline-in-rust.html
the small examples and faust2* projects should not be affected by this change as far as I understood.

do you have opinions on this?
@bluenote10

@crop2000
Copy link
Contributor Author

this pr shows a solution (and a discussion of the problem)
https://github.com/rust-lang/hashbrown/pull/119/files
Similar to our use of default-boxed it this should lead to compiler warnings if the Cargo.toml isn't prepared for that.

@sletz
Copy link
Member

sletz commented Dec 10, 2024

In practice, what kind of functions are called "often enough" to justify inlining ? get_param/set_param/compute possibly ? Most of the others are called like once at init time or a few times like build_user_interface.

Any concrete use case of the "inlining across crate boundaries" you can see ?

@crop2000
Copy link
Contributor Author

Yes,especially get and set parameters and compute. The inline flag does not force inlining but makes it possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants