Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    672
    Thanks
    1
    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
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    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
    •