Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Sep 3, 2016
1 parent f6df3e8 commit fbf27c4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
* [Correct method](/regexp/methods.md)

* [String]
* [+= for concat](/string/concat.md)
* [Interpolating variables](/string/concat.md)
4 changes: 1 addition & 3 deletions bibliography.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
9 changes: 7 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# 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.
- If your tip is very similar to a tip that already exists, consider extending the first tip.
- 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.
2 changes: 1 addition & 1 deletion string/concat.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
8 changes: 4 additions & 4 deletions workflow/lookup-table.md
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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

Expand All @@ -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:
Expand Down

0 comments on commit fbf27c4

Please sign in to comment.