question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hoist RegExp Literals in SourceMapDevToolPlugin

See original GitHub issue

Bug report

What is the current behavior? The use of RegExp literals create unnecessary object references/allocations especially in iterated hot paths like SourceMapDevToolPlugin. We should hoist these to the top of file and give them useful names so people understand what the heck they do.

If the current behavior is a bug, please provide the steps to reproduce. Some Examples:

Mapping over a RegExp literal: https://github.com/webpack/webpack/blob/3ad4fcac25a976277f2d9cceb37bc81602e96b13/lib/SourceMapDevToolPlugin.js#L419

Big Async ForEach Statement with multiple RexExp Literal statements: https://github.com/webpack/webpack/blob/3ad4fcac25a976277f2d9cceb37bc81602e96b13/lib/SourceMapDevToolPlugin.js#L384-L551

What is the expected behavior? Less memory allocation, less garbage collection triggered.

Happy to PR this. There are quite a few of these examples still lying around webpack that should be cleaned up but I’ll start with this.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
TheLarkInncommented, Apr 28, 2022

image

@markjm Here is an example of mem allocation hotpath if this helps. This tree is during the forEach calls referenced in the PR.

0reactions
webpack-botcommented, Nov 13, 2022

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SourceMapDevToolPlugin - webpack 3 documentation
This plugin enables more fine grained control of source map generation. It is an alternative to the devtool configuration option. new webpack.
Read more >
Newest 'terser' Questions - Stack Overflow
I want to use Terser's webpack plugin to uglify (mangle property names) in my project. The problem is webpack/babel is fixated on transpiling...
Read more >
thisisnic/starrating source listing - Rdrr.io
node_modules/@babel/generator/lib/generators/template-literals.js ... node_modules/@babel/helper-hoist-variables/package.json.
Read more >
Work for Performance - Open performance-issues in open ...
... webpack/webpack - Treeshaking with side effect free package is unexpectedly slow · webpack/webpack - Hoist RegExp Literals in SourceMapDevToolPlugin ...
Read more >
Automated Malware Analysis Executive Report for pgadmin4 ...
... -helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz# ... plugin-transform-es2015-template-literals/-/babel-plugin-transfor.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found