-
-
Notifications
You must be signed in to change notification settings - Fork 884
avm2: Speed up some native calls #20328
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
base: master
Are you sure you want to change the base?
avm2: Speed up some native calls #20328
Conversation
An alternative (maybe simpler to implement?) could be to sort the static array, and use |
331d20c
to
9fd9345
Compare
// "[Ruffle(FastCall)]". Unlike the rest, it is not indexed by method id- | ||
// instead, every item in the list is a method id. | ||
// | ||
// FIXME: should this be some sort of hashset? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you sorted the vec before putting it in, we could use binary_search
instead of iter().any()
to speed up* lookups without affecting memory use at all.
Alternatively, there's always https://github.com/rust-phf/rust-phf to construct a static hashset at compile time (and thus not waste any allocations), but might be an overkill here.
(*I imagine the difference might not matter as long as we have <100 fast methods. )
GetProperty and CallProperty optimization logic have been moved to their own methods
Added to methods on Class, Function, Namespace, QName, String, Vector, XML and XMLList, Graphics, SoundTransform, as well as some toplevel functions and `getTimer`.
9fd9345
to
b742a7b
Compare
… `NativeCallable` metadata to the playerglobals README
b742a7b
to
5289ba4
Compare
This allows us to optimize some calls to native functions when
[Ruffle(FastCall)]
annotation,final
.For example,
Math.abs
runs more than twice as fast with this PR as it does on currentmaster
. From my testing, in most SWFs, 5-20% of calls that would beCallMethod
are nowCallNative
.Box2d stats:
TODO: