Development Mode/Production Mode

David Bruant bruant.d at gmail.com
Tue Apr 3 08:16:56 PDT 2012


Le 03/04/2012 17:12, John J Barton a écrit :
> On Tue, Apr 3, 2012 at 7:03 AM, David Bruant <bruant.d at gmail.com 
> <mailto:bruant.d at gmail.com>> wrote:
>
>     Le 01/04/2012 13:38, Wes Garland a écrit :
>
>         In a similar vein, I would personally like to have
>         zero-cost-when-not-debugging assert() statements, and am
>         hopeful that statically-linked modules might lead the way.
>
>     It seems to me that what you're asking for is macros, isn't it?
>     I read hints here and there that it's a very hard problem that is
>     being worked on for a later ES version.
>
>
> Since most JS is compiled in the run time, macros are not zero cost.
Wes mentionned:
"As a data point, we compile all our code through Mozilla's SpiderMonkey 
engine with JSOPTION_STRICT, which pre-dates ES5 strict mode, during our 
build phase."

It seems to me that it would be equivalent work to remove macros with 
such a compilation phase, making the macro cost effectively zero in 
run-time phase.

> Since most JS runs in a sophisticated JIT capable of dead code 
> elimination,
>   const debug = false;
Macros would probably also be less intrusive than a top-scope variable, 
but I may be wrong on this part.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120403/377b0d6b/attachment.html>


More information about the es-discuss mailing list