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

avm2: Cache method body index on Method #17834

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

adrian17
Copy link
Collaborator

@adrian17 adrian17 commented Sep 9, 2024

This fixes quadratic behavior observable with >>1000 classes. On Habbo SWF, on desktop it shaves like 100ms and on FF it improves load time by 0.5-1s.

method_bodies.push(self.read_method_body()?);
for body_idx in 0..len {
let body = self.read_method_body()?;
methods[body.method.0 as usize].body = Some(Index::new(body_idx));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If FP verifyerrors here when there is already a Method attached to the MethodBody can we check and panic?

Copy link
Collaborator Author

@adrian17 adrian17 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we wanna panic, or just log::warn and continue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is in swf, so can't really log from there either...
And we ideally shouldn't panic in swf as it's more of a library :/
Gonna Err then.

@adrian17 adrian17 force-pushed the avm2-faster-load-method branch 3 times, most recently from 94c407b to a8180c7 Compare September 9, 2024 21:29
@adrian17 adrian17 merged commit 176b70b into ruffle-rs:master Sep 9, 2024
16 of 17 checks passed
@adrian17 adrian17 deleted the avm2-faster-load-method branch September 9, 2024 21:45
@evilpie evilpie added the T-perf Type: Performance Improvements label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-perf Type: Performance Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants