

GitHub - jamiebuilds/tickedoff: Tiny library (<200B gzip) for deferring somet...
source link: https://github.com/jamiebuilds/tickedoff
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
tickedoff
Tiny library (<200B gzip) for deferring something by a "tick"
- Using
setTimeout
is actually a bit slow because its clamped to 4ms setImmediate
is not available in most places (and probably never will be)process.nextTick
is only in NodePromise#then
needs polyfills in placestickedoff
uses whatever the best available option is- There are more robust libraries/polyfills but they are larger in size
- This is all especially good for libraries to use
Install
yarn add tickedoff
Usage
const defer = require('tickedoff'); console.log(1); defer(() => console.log(3)); console.log(2); // 1 // 2 // 3
Perf
$ node perf.js process.nextTick x 10000 = 24ms Promise#then x 10000 = 29ms setImmediate x 10000 = 68ms setTimeout x 10000 = 13506ms
Recommend
-
116
unstated - State that goes without saying
-
73
README.md roast-my-deps Your dependencies are bad and you should feel bad Install yarn add roast-my-deps Example From
-
104
-
74
README.md react-performance-observer Get performance measurements from React Fiber Install yarn add --dev react-performance-observer
-
53
README.md write-files-atomic Write many files atomically Creates temporary files with file contents Mov...
-
50
README.md Ghost Lang ? A friendly little language for you and me. Motivation Ghost is the language I wish we had. There are so m...
-
87
README.md Babel Handbook A guided handbook on how to use Babel and how to create plugins for Babel. Translations
-
6
Deferring Tasks in Laravel Using Queuesby Sajal SoniDec 18, 2017(Updated Mar 22, 2022)Read Time:15 minsLanguages: In this article, we're going t...
-
10
Performance is an essential aspect of any production application, and GitHub is no exception. In the last year, we’ve been making significant investments to improve the performance of some of our most critical workflows. There’s a lot to shar...
-
6
Go: When deferring a lock smells
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK