-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improve function call performance #159
Conversation
ksh8281
commented
Sep 6, 2023
- Divide function into user-defined function and user-defined function /w try-catch
- Non try-catch user-defined function should not use c++ try-catch
- Reduce parameter count of Interpreter::interpret
* Divide function into user-defined function and user-defined function /w try-catch * Non try-catch user-defined function should not use c++ try-catch * Reduce parameter count of Interpreter::interpret Signed-off-by: Seonghyun Kim <[email protected]>
|
{ | ||
Memory** memories = reinterpret_cast<Memory**>(reinterpret_cast<uintptr_t>(instance) + Instance::alignedSize()); |
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.
Why don't you initialize memories
as instance->m_memories
?
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.
And is it enough to initialize local memories
only?
Other structures like tables, globals don't need local variables since they are not accessed frequently like memories, right?
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.
Why don't you initialize memories as instance->m_memories?
-> I tested two way of init memories.
. access instance->m_memories -> needs memory access
. computing address(reinterpret_cast<Memory**>(reinterpret_cast<uintptr_t>(instance) + Instance::alignedSize())) -> needs ALU on CPU
the second way shows better performance when I tested
And is it enough to initialize local memories only?
-> Yes. only memories is used frequently when I tested
but globals and tables are don't. but it needs a space on stack
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.
LGTM