Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: "use strict"

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Thanked 1 Time in 1 Post

    "use strict"

    See http://ejohn.org/blog/ecmascript-5-s...json-and-more/

    If I rework my scripts to work with "use strict", in theory, will they generally perform better, despite potential scripts growing in size? I hear there are some optimizations browsers will do and the changes may help. If so, would these optimizations be automatic or should I leave "use strict" in place to trigger them?

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 608 Times in 588 Posts
    stict mode is less powerful and easier to compile. if you have performance problems, use strict MAY help, but only in browsers than support it. On the other hand, JIT is so advanced these days performance is not nearly as important as it was when ecma5 was drafted just a few years ago...

    in general, strict kills many potential performance-hampering features of js like with and eval. Those commands don't always hurt performance, but they certainly can, and avoiding them means you avoid the potential problems. So, just writing code that works with the strict sub-set of valid js is likely just as good as formally declaring strict mode.

    Strict does make it easier to maintain that discipline because it throws errors when you break the guidelines. but i don't think the guidelines are all that relevant anyway, provided you know exactly what/how you are programming.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts