-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Code optimizations #1150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code optimizations #1150
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ed3ba4d:
|
@@ -24,6 +25,10 @@ import { | |||
|
|||
type Revalidator = (...args: any[]) => void | |||
|
|||
// Generate strictly increasing timestamps. | |||
let __timestamp = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you feel it's okay to start timestamp from 1
to avoid some issue like !now()
? not blocking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 (where are we using !now()
btw?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we used to have this issue in #1075
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked again, we are using const now = () => ++__timestamp
so it will be starting from 1 I think.
Did a couple of code optimizations in this PR for better structure and code reusing. Also handles the case that
undefined
is manually set to another value*.As a result, here's the size of the built
dist/index.js
with this PR:*Although Rollup handles it automatically by changing it to
void 0
, it's great to have it in the source code. This trick also makes the built file smaller.