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

Disable sourcemaps support in babel if input is big #2345

Merged
merged 7 commits into from
Jan 19, 2022

Conversation

mstoykov
Copy link
Contributor

This prevents babel from using up a lot of memory (3.5x as much as
before source maps) on really big inputs.

This prevents babel from using up a lot of memory (3.5x as much as
before source maps) on really big inputs.
js/compiler/compiler.go Outdated Show resolved Hide resolved
js/compiler/compiler.go Outdated Show resolved Hide resolved
js/compiler/compiler.go Outdated Show resolved Hide resolved
@na-- na-- added this to the v0.36.0 milestone Jan 18, 2022
Comment on lines 151 to 152
c.logger.Warnf("the source for `%s` needs to go through babel but is over %d bytes. "+
"For performance reasons sourcemaps support will be disabled for this particular file.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention K6_DEBUG_SOURCEMAP_FILESIZE_LIMIT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't mention this, for a couple of reasons:

  • K6_DEBUG_SOURCEMAP_FILESIZE_LIMIT=whatever k6 cloud won't work
  • we intend to get rid of this option eventually

So we shouldn't really document this. It's a temporary option until we get rid of Babel. We can always mention it and the caveats if someone asks in the forum.

js/compiler/compiler.go Outdated Show resolved Hide resolved
code, srcMap, err = c.babel.transformImpl(c.logger, src, filename, c.Options.SourceMapLoader != nil, inputSrcMap)
sourceMapEnabled := c.Options.SourceMapLoader != nil
maxSrcLenForBabelSourceMapOnce.Do(func() {
// TODO: drop this code and everything it's connected to when babel is dropped
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have an issue to link?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2296 (comment) maybe? 🤔

Copy link
Contributor

@codebien codebien Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm...if we don't have one yet, I'm for creating one dedicated with the steps we plan for dropping babel. For example, it would be useful to have somewhere a link to dop251/goja#348 and this potential new issue could be a good candidate, IMHO.

It's mentioned in your comment, sorry, my fault.

js/compiler/compiler.go Outdated Show resolved Hide resolved
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🤞

Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mstoykov mstoykov merged commit 46d1d98 into master Jan 19, 2022
@mstoykov mstoykov deleted the limitBabelSourceMaps branch January 19, 2022 08:05
@yorugac yorugac mentioned this pull request Jan 19, 2022
oleiade pushed a commit that referenced this pull request Jan 26, 2022
This prevents babel from using up a lot of memory (3.5x as much as
before source maps) on really big inputs.

Co-authored-by: na-- <[email protected]>
Co-authored-by: Ivan <[email protected]>
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.

4 participants