-
Notifications
You must be signed in to change notification settings - Fork 745
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
Set an absolute maximum inlining limit #3959
Conversation
auto combinedSize = infos[target].size + infos[source].size; | ||
// Estimate the binary size from the number of instructions. | ||
auto estimatedBinarySize = Measurer::BytesPerExpr * combinedSize; | ||
const Index MaxCombinedBinarySize = 400 * 1024; |
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.
Is this an arbitrary limit? Maybe good to add a single-line comment on what this is. If this is an arbitrary limit, stating that will help readers too, in case they think this number has a specific meaning.
src/passes/Inlining.cpp
Outdated
@@ -446,6 +449,20 @@ struct Inlining : public Pass { | |||
// return whether we did any work | |||
return inlinedUses.size() > 0; | |||
} | |||
|
|||
// Checks if we are allowed to inline source into target. | |||
bool canInlineInto(Name target, Name source) { |
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.
Nit: How about isProfitableToInline
or something..? It is not that technically we cannot inline but we choose not to because of performance reasons..
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.
Maybe isUnderSizeLimit
to be precise?
Thanks for the feedback, done. |
We have seen some cases in both Chrome and Firefox where
extremely large modules cause overhead,
#3730 (comment) (and link therein)
emscripten-core/emscripten#13899 (comment)
There is no "right" value to use as a limit here, but pick an
arbitrary one that is very high. (This setting is verified to have
no effect on the emscripten benchmark suite.)