-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
609 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Parsing can be slow. | ||
As as **1MB/s on mobile** | ||
|
||
One way to reduce the parsing time is to have less code | ||
Another way is todo as much parsing as you need and as little as you can get away with. | ||
|
||
### Parsing happens in two phases | ||
|
||
- eager (full parse) This is what you think of when you think about parsing. | ||
- lazy (pre-parse) do the bare minimum now. We'll parse it for realsies later. | ||
|
||
> In general lazy loading is a good thing. | ||
### The basic rules | ||
|
||
- Scan through the top-level scope. Parse all the code you see that's actually doing something. | ||
- Skip things like function declarations and classes for now. We'll parse them when we need them. | ||
|
||
### This could bit us. But how? | ||
|
||
```js | ||
// These will be eagerly-parsed | ||
const a = 1 | ||
const b = 2 | ||
|
||
// Take not that there's a function here, | ||
// but, we'll parse the body when we need it | ||
function add(a, b) { | ||
return x + y | ||
} | ||
|
||
add(a, b) // Whoa. Go back and parse add()! | ||
``` | ||
|
||
**Corollary:** Doing stuff twice is slower than doing it once. | ||
|
||
### Try to avoid nested functions | ||
|
||
```js | ||
function sumOfSquares(x, y) { | ||
// this nested function will repeatedly be parsed. | ||
function square(n) { | ||
return n * n | ||
} | ||
|
||
return square(x) + square(y) | ||
} | ||
``` | ||
|
||
If move that out | ||
|
||
```js | ||
function square(n) { | ||
return n * n | ||
} | ||
function sumOfSquares(x, y) { | ||
return square(x) + square(y) | ||
} | ||
``` | ||
|
||
### Okay, cool - so it's parsed. Now what? |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.attribution-container { | ||
padding: 20px 25px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.contact-container { | ||
padding: 20px 25px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.interests-container { | ||
padding: 20px 25px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
.general-container { | ||
display: flex; | ||
font-size: 14px; | ||
flex-direction: column; | ||
display: flex; | ||
font-size: 14px; | ||
flex-direction: column; | ||
padding: 20px 25px; | ||
} | ||
|
||
.general-container > p { | ||
color: var(--light-gray); | ||
color: var(--light-gray); | ||
} | ||
|
||
.about-text { | ||
color: var(--main-color); | ||
background-color: var(--black); | ||
height: 100%; | ||
padding: 5px; | ||
color: var(--main-color); | ||
background-color: var(--black); | ||
height: 100%; | ||
padding: 5px; | ||
} | ||
|
||
.about-text .link { | ||
color: var(--main-color); | ||
text-decoration: underline; | ||
color: var(--main-color); | ||
text-decoration: underline; | ||
} | ||
|
||
.about-text code { | ||
color: #fff; | ||
display: block; | ||
color: #fff; | ||
display: block; | ||
} | ||
|
||
.about-text span { | ||
color: var(--palevioletred); | ||
margin-right: 5px; | ||
color: var(--palevioletred); | ||
margin-right: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.mission-container { | ||
font-size: 12px; | ||
padding: 20px 25px; | ||
} | ||
|
||
.mission-item { | ||
|
Oops, something went wrong.