mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-29 12:46:32 +03:00
add lang annotation to code examples
This commit is contained in:
parent
ba69f7e4be
commit
3b13705fbf
@ -240,20 +240,20 @@ const _Utils_update = (oldRecord, updatedFields) =>
|
|||||||
|
|
||||||
At the call site, replace
|
At the call site, replace
|
||||||
|
|
||||||
```
|
```js
|
||||||
_Utils_update(old, newFields)
|
_Utils_update(old, newFields);
|
||||||
```
|
```
|
||||||
|
|
||||||
with
|
with
|
||||||
|
|
||||||
```
|
```js
|
||||||
Object.assign({}, old, newFields)
|
Object.assign({}, old, newFields);
|
||||||
```
|
```
|
||||||
|
|
||||||
Or we can use the spread operator inline:
|
Or we can use the spread operator inline:
|
||||||
|
|
||||||
```
|
```js
|
||||||
{...old, ...new}
|
{...old, field: new}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Result Summary
|
## Result Summary
|
||||||
@ -319,14 +319,14 @@ Chrome doesn't really see a speedup here though, so it's likely smart enough to
|
|||||||
|
|
||||||
Before
|
Before
|
||||||
|
|
||||||
```
|
```js
|
||||||
String$fromFloat(val)
|
String$fromFloat(val);
|
||||||
```
|
```
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
|
||||||
```
|
```js
|
||||||
val + ""
|
val + '';
|
||||||
```
|
```
|
||||||
|
|
||||||
## Results Summary
|
## Results Summary
|
||||||
@ -339,14 +339,14 @@ This hasn't shown any measureable benefit. Likely because this is such a simple
|
|||||||
|
|
||||||
Before
|
Before
|
||||||
|
|
||||||
```
|
```js
|
||||||
var x = function(x){}
|
var x = function (x) {};
|
||||||
```
|
```
|
||||||
|
|
||||||
After
|
After
|
||||||
|
|
||||||
```
|
```js
|
||||||
var x = (x) => {}
|
var x = (x) => {};
|
||||||
```
|
```
|
||||||
|
|
||||||
This was done for asset size. The nuance being that it's done to potentially optimize the _minified_ size of code, but not necessarily the gzipped version.
|
This was done for asset size. The nuance being that it's done to potentially optimize the _minified_ size of code, but not necessarily the gzipped version.
|
||||||
|
Loading…
Reference in New Issue
Block a user