From fbf27c4a6109f523c4a1344ab1bd0aa0236c014c Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Sat, 3 Sep 2016 13:42:18 +0200 Subject: [PATCH] Update --- assets/README.md | 2 +- bibliography.md | 4 +--- contributing.md | 9 +++++++-- string/concat.md | 2 +- workflow/lookup-table.md | 8 ++++---- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/assets/README.md b/assets/README.md index fead932..f0a0bff 100644 --- a/assets/README.md +++ b/assets/README.md @@ -42,4 +42,4 @@ * [Correct method](/regexp/methods.md) * [String] - * [+= for concat](/string/concat.md) + * [Interpolating variables](/string/concat.md) diff --git a/bibliography.md b/bibliography.md index ade3ebf..1ee62a3 100644 --- a/bibliography.md +++ b/bibliography.md @@ -4,13 +4,11 @@ * [High Perfomance JavaScript by Nicholas C. Zakas](https://www.google.com/search?q=high+perfomance+javscript&oq=high+perfomance+javscript&aqs=chrome..69i57j0l5.2601j0j1&sourceid=chrome&ie=UTF-8#q=high+performance+Javascript+by+Nicholas+C.+Zakas). - -**Video** +**Videos** * [Google I/O 2012 - Breaking the JavaScript Speed Limit with V8](https://www.youtube.com/watch?v=UJPdhx5zTaw). * [Using jsPerf correctly](https://www.youtube.com/watch?v=RLbAKxCAdI8) ([slides](http://www.slideshare.net/mathiasbynens/using-jsperf-correctly)). - **Articles** * [Optimization killers](https://github.com/petkaantonov/bluebird/wiki/Optimization-killers). diff --git a/contributing.md b/contributing.md index 0600065..7bb9a5d 100644 --- a/contributing.md +++ b/contributing.md @@ -1,8 +1,12 @@ # Send your tip! -To submit a tip, create a PR in our [GitHub repository](https://github.com/Kikobeats/js-mythbusters). +The purpose of esta handbook is the last language use features without losing performance. -Before adding your tip take into consideration the following guidelines: +You can see on [Six Speed](https://kpdecker.github.io/six-speed/) how faster ES6 run. Also use [Node Green](http://node.green/) to know the native support of each feature. + +If you want to submit a tip, create a PR in our [GitHub repository](https://github.com/Kikobeats/js-mythbusters). + +Before adding your tip, take into consideration the following guidelines: - Add your tip in the correct section. Each different section is a folder (for example [v8-tips](https://github.com/Kikobeats/js-mythbusters/tree/master/v8-tips) or [workflow](https://github.com/Kikobeats/js-mythbusters/tree/master/workflow)). - Inside the folder, each file is a tip. @@ -10,3 +14,4 @@ Before adding your tip take into consideration the following guidelines: - Don't add more than one tip per file. - The text that describes the tip has to be concise and precise. - To avoid extending tips till they are too big, you can reference other tips instead. +- Add the correct [resources](https://github.com/Kikobeats/js-mythbusters/blob/master/resources.md) associated with the tip. diff --git a/string/concat.md b/string/concat.md index caf5182..21bcec8 100644 --- a/string/concat.md +++ b/string/concat.md @@ -1,4 +1,4 @@ -# Use `+=` for concat +# Interpolating variables Instead of [String.prototype.concat()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat). diff --git a/workflow/lookup-table.md b/workflow/lookup-table.md index 3b16355..806873d 100644 --- a/workflow/lookup-table.md +++ b/workflow/lookup-table.md @@ -1,6 +1,8 @@ # Lookup table for result matching -When optimizing `if`/`else`, minimize the number of conditions to evaluate. This applies to `switch` cases as well. The easiest optimization is to ensure that the most common conditions are first: +When optimizing `if`/`else`, minimize the number of conditions to evaluate. This applies to `switch` cases as well. + +The easiest optimization is to ensure that the most common conditions are first: ```js if (value < 5) { @@ -28,7 +30,7 @@ var myValue = 5 lookupTable[compare(4, myValue)] ``` -In objects, you may also use `undefined` or `''` as keys. +In objects, you may also use *falsy* values as keys. ## Array vs. Object @@ -37,8 +39,6 @@ Also be careful about choose between `Object` or `Array` for this purpose: - If you need a incremental index, use `Array`. - In other cases, use `Object`. -In ES2015, also consider using `Map` or `Set` combined with `Symbol`. - ## Caveats Although is more readable, using a lookup table isn't always better. The cost of creating the lookup table could be higher than the use set of `if`/`else` statements. So, it depends about your code running time: