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

Set an absolute maximum inlining limit #3959

Merged
merged 2 commits into from
Jul 1, 2021
Merged

Set an absolute maximum inlining limit #3959

merged 2 commits into from
Jul 1, 2021

Conversation

kripken
Copy link
Member

@kripken kripken commented Jun 29, 2021

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.)

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;
Copy link
Member

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.

@@ -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) {
Copy link
Member

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..

Copy link
Member

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?

@kripken
Copy link
Member Author

kripken commented Jun 30, 2021

Thanks for the feedback, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants