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

Marshalling time of custom types is dominated by hash computation #224

Closed
Imberflur opened this issue Jun 13, 2020 · 4 comments
Closed

Marshalling time of custom types is dominated by hash computation #224

Imberflur opened this issue Jun 13, 2020 · 4 comments
Labels
exp: intermediate Achievable by experienced contributors, or with some guidance pri: intermediate An issue resulting in non-critical functionality loss and no significant effect on usability type: perf Changes that improve performance

Comments

@Imberflur
Copy link

flamegraph.svg.zip
image

This seems like something that could be vastly improved by caching the type_guid computation for StructRef but there may be a reason that this is not being done.

impl ReturnTypeReflection for StructRef {
    type Marshalled = RawStruct;

    fn type_name() -> &'static str {
        "struct"
    }
}
@Wodann
Copy link
Collaborator

Wodann commented Jun 13, 2020

Good find. There is no reason why ReturnTypeReflection::<StructRef>::type_guid can not be constant. I'll look into optimising this, thanks! 🙂

Also, exciting to see that you are considering this for Veloren 👍

@baszalmstra
Copy link
Collaborator

@Wodann You are currently working on a fix for this right?

@baszalmstra baszalmstra added exp: intermediate Achievable by experienced contributors, or with some guidance pri: intermediate An issue resulting in non-critical functionality loss and no significant effect on usability type: perf Changes that improve performance labels Jun 20, 2020
@Wodann
Copy link
Collaborator

Wodann commented Jun 21, 2020

I have a branch with the improvement, but wanted to add some additional benchmarks as well. I was working on a second performance improvement based on that.

The first pass can be found at: https://github.com/Wodann/mun/tree/improve/struct-marshalling-perf

@Wodann
Copy link
Collaborator

Wodann commented Jul 28, 2020

Resolved by #238.

@Wodann Wodann closed this as completed Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp: intermediate Achievable by experienced contributors, or with some guidance pri: intermediate An issue resulting in non-critical functionality loss and no significant effect on usability type: perf Changes that improve performance
Projects
None yet
Development

No branches or pull requests

3 participants