-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
golf: save
navigator.connection
to var;
- reuses unused param name for addl 3 bytes 😇 - 710 gz / 579 br
- Loading branch information
Showing
1 changed file
with
4 additions
and
10 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
5f95309
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'm not sure if this code golfing is worth it: Not 100% confident, but I think re-using an argument makes V8 work slower. Also, if not every
prefetcher
call includes the third argument, V8 needs to add aArgumentsAdaptorTrampoline
- see here: https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html#optimizing-sorting---argument-adaptationIt is out of my scope if the less bytes are worth less performance or not.
5f95309
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.
This is true, but yes – I chose bytes here since the performance deopt here isn't really of concern. These calls to
prefetcher
happen once or twice on a page's lifecycle. It's also a background process, effectively. Squeezing every bit of req/s doesn't really matter here.Plus the shear number of requests would be prove the network to be the bottleneck far before the deopt from the golf hack could be reached.