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.

Optimizer or minifier ?

See original GitHub issue

This is more of a question than an issue.

Is the Optimizer more an optimizer or a minifier? Or both at the same time?

Currently, the Optimizer does some “optimizations” that actually increase the length of the regexp, like: /aa/ (2) -> /a{2}/ (4) /a|b/ (3) -> /[ab]/ (4) /aa+/ (3) -> /a{2,}/ (5) If it’s supposed to be a minifier, we should try to avoid those cases. (Note that this could be tricky sometimes, since an optimization might not seem worth it at first, but work well with following optimizations)

Also, if we really want minification, we could add additional transforms like: find the shortest representation of a char: /\u0010/ (6) -> /\x10/ (4) /\u0000/ (6) -> /\0/ (2) convert all coded chars to their printable equivalent (even outside of basic printable ASCII range): /\u{dd}/u (6) -> /Ý/ (1) reorder class ranges in a way to avoid escaping: /[\^a]/ (5) -> /[a^]/ (4) /[,\-.]/ (6) -> /[,.-]/ (5) and so on.

What’s your opinion on this?

I intend to start working on actual options for the optimizer. The whitelist is a good start, but it’s kind of verbose and does not really allow for “optional” transforms. I think an object of options with default values would be more appropriate (something like the compress options in UglifyJS).

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

DmitrySoshnikovcommented, Dec 8, 2017

@Golmote, yep, agreed; all good points! I am fully supportive here.

DmitrySoshnikovcommented, Feb 15, 2018


I could definitely go check and try to remove some of the bad optimizations I mentionned in the first post (#135 (comment)), though!

Sounds good to me, yeah, we can probably exclude the one @swernerx mentions with the single chars.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimize Components (Minify) for Better Performance
You can use the RequireJS optimizer to minify and combine source code. Minifying a component removes unwanted space in the JavaScript code, resulting...
Read more >
MinifyMe ‑ File Optimizer - Minify CSS, JavaScript, and Liquid ...
Reduce the size of your JavaScript, Liquid, and CSS files for improved speed. Anyone can minify their files with the press of a...
Read more >
Minify Resources (HTML, CSS, and JavaScript)
Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser - ...
Read more >
The Smaller the Better, When It Comes to Page Resources!
The following are 5 solutions to make your page content lighter: Enable Compression; Minify Resources; Optimize Images; Optimize CSS Delivery; Prioritize ...
Read more >
JavaScript Minifying Tools and Methods That Work - FastComet
WP-Optimize is a WordPress optimization plugin that includes a sophisticated minification tool for minifying CSS and JavaScript, ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found