Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-28-2011, 10:24 PM   PM User | #1
Tails
Regular Coder

 
Join Date: Nov 2002
Posts: 672
Thanks: 1
Thanked 1 Time in 1 Post
Tails is an unknown quantity at this point
"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?
Tails is offline   Reply With Quote
Old 08-29-2011, 08:15 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, optimization, performance, strict, use strict

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:58 AM.


Advertisement
Log in to turn off these ads.