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.

More optimizations

See original GitHub issue
  • Remove unused args (e.g. bar in function foo(bar) { })
  • Remove space after return when possible (e.g. return [1,2,3]return[1,2,3])
  • var result = expression(); foo.bar = result;foo.bar = expression()
  • Better constant propagation (looks like it is in the dead-code-elimination plugin, but its a combination of both)
var b = () => {
  var x = 14;
  var y = 7 - x / 2;
  return y * (28 / x + 2);
};
var a = () => {
  var a = 14;

  return (7 - a / 2) * (28 / a + 2);
};

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:26 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
sebmckcommented, Jul 6, 2016

We can’t turn function functions into arrow functions. It’s an unsafe optimisation. Arrow functions have no prototype and cannot be used as constructors so they aren’t the same.

2reactions
j-f1commented, May 2, 2018

Coming from #591, where @loganfsmyth suggested (after some discussion) that babel-minify place a _void0 or similar variable at the top, then replace all uses of undefined with it, allowing for mangling:

It should be possible to either put the var _void0 variable at the top of sourceType: module scripts or ones that are node modules. In other cases, they can be put at the top of function scopes, or the entire code could be wrapped in a block:

{
let _void0
// code here
}

This would increase code size if void 0 only appeared once, but would save 5 characters if used twice and 11 if used thrice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Top 10 Essential Website Optimization Strategies
This post will delve into which factors carry the most weight and how to optimize for each. 1. Search Intent. As machine learning,...
Read more >
Optimize More! - Plugins - WordPress.org
Optimizing web pages is really just about controlling how assets are delivered. This plugin gives you the ability to choose different assets to...
Read more >
Optimize Definition & Meaning - Merriam-Webster
The meaning of OPTIMIZE is to make as perfect, effective, or functional as possible. How to use optimize in a sentence.
Read more >
Optimize Options (Using the GNU Compiler Collection (GCC))
Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With -O , the compiler tries to reduce...
Read more >
Optimization tips for Performance Max - Google Ads Help
Because of this, we recommend using the following best practices to set up your Performance Max campaigns for success and help further optimize...
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