-
Notifications
You must be signed in to change notification settings - Fork 38
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
Pass arguments as const Value* #552
Conversation
18a67f3
to
7208c06
Compare
7208c06
to
12d71d3
Compare
This gives me a ~10% speed up on the call heavy benchmarks. And (appropriately) combining this with #554 results in 30% total gain. Independently they produce 10-15% each. |
@@ -189,7 +189,7 @@ TEST(operand_stack, small) | |||
TEST(operand_stack, small_with_locals) | |||
{ | |||
const fizzy::Value args[] = {0xa1, 0xa2}; | |||
OperandStack stack(args, 3, 1); | |||
OperandStack stack(args, std::size(args), 3, 1); |
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.
Here is example where std::size()
is better than sizeof
.
@@ -99,8 +99,8 @@ TEST(api, resolve_imported_functions) | |||
module, external_functions, {}, {}, std::vector<ExternalGlobal>(external_globals)); | |||
|
|||
EXPECT_THAT(execute(*instance, 0, {}), Result(0)); | |||
EXPECT_THAT(execute(*instance, 1, {0}), Result(1)); | |||
EXPECT_THAT(execute(*instance, 2, {0}), Result(2)); | |||
EXPECT_THAT(execute(*instance, 1, {Value{0}}), Result(1)); |
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.
When passing single 0, clang thinks it should go as nullptr
. This is a workaround.
Codecov Report
@@ Coverage Diff @@
## master #552 +/- ##
=======================================
Coverage 98.24% 98.24%
=======================================
Files 62 62
Lines 9048 9052 +4
=======================================
+ Hits 8889 8893 +4
Misses 159 159 |
|
Looks good to me, but do you want to squash in the review comments? |
Of course. |
The arguments list {0} causes issues in later changes due to Clang compiler issue, https://bugs.llvm.org/show_bug.cgi?id=47704
Part of #526 and #563.
Pass arguments to
execute()
asconst Value*
, without providing information about number of arguments. Previously arguments were passed asspan<const Value>
.Also "host function" may be changed accordingly in following PR.
Some parts may be committed separately: 2 first commits, the
{Value(0)}
change in unit tests.