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

Procedure macro #10

Open
cmpute opened this issue May 14, 2022 · 1 comment
Open

Procedure macro #10

cmpute opened this issue May 14, 2022 · 1 comment

Comments

@cmpute
Copy link

cmpute commented May 14, 2022

I think it will be more idiomatic to mark the profiling function like this

#[profile_fn]
fn fn_name<T>(param: T) {
    // If a function is complex, profile a section.
    #[profile_section]
    {
        // Optional: manually drop.
        // Section automatically drops when going out of scope.
        drop(inner);
    }
}

This API looks like the profiling crate, and it looks more ergonomic to me.

@That3Percent
Copy link
Owner

I agree that appears less verbose, and is especially nice in that the function signature need not be duplicated. IDE support for macros can be hit or miss though. Also, sometimes compile times can be negatively affected. So, it's not a clear win. We could provide it as an option though.

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