Re:Security concerns with minified JavaScript code
by tedunangst on Monday August 31, 2015 @02:09PM
(#10148170)
How much of that 15 to 60 fps speed up can be obtained simply by setting the variable thisIsDev to false without eliding the code?
For React-Native for example, I've heard people going from 15fps animation to 60fps when going into prod (!). I always tell them to benchmark their animation on the prod build, because dev build is _not_ representative of the perf you get.
Granted, it doesn't necessarily need to be the minifier's job. But that's the way things are currently done in JS.
If the minifier provides that much more incentive for helpful error messages then I'm all for it. It has helped us avoid a huge amount of duplicate questions when people start with React too. As a matter of fact, I think most libraries should adopt this approach for this feature alone (Webpack makes this process less of a hassle, but we can do better). Otherwise you'd be caught between inserting expensive checks and not inserting them out of perf concern, which would be a true premature optimization.