-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
10 changed files
with
16,635 additions
and
12,537 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"node": "18", | ||
"installCommand": "codesandbox:install", | ||
"sandboxes": [] | ||
} |
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,3 +1,5 @@ | ||
enableHardenedMode: false | ||
|
||
nodeLinker: node-modules | ||
|
||
plugins: | ||
|
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,8 +1,7 @@ | ||
$ node benchmarks/benchmark.cjs | ||
┌───────────┬────────────┬──────────────┬───────────────────┬────────────┬────────────────┬───────────┬─────────────────┐ | ||
│ (index) │ synckit │ sync-threads │ perf sync-threads │ deasync │ perf deasync │ native │ perf native │ | ||
├───────────┼────────────┼──────────────┼───────────────────┼────────────┼────────────────┼───────────┼─────────────────┤ | ||
│ loadTime │ '9.01ms' │ '0.80ms' │ '11.29x slower' │ '20.32ms' │ '2.26x faster' │ '0.37ms' │ '24.37x slower' │ | ||
│ runTime │ '109.97ms' │ '5166.40ms' │ '46.98x faster' │ '557.75ms' │ '5.07x faster' │ '10.56ms' │ '10.41x slower' │ | ||
│ totalTime │ '118.98ms' │ '5167.20ms' │ '43.43x faster' │ '578.07ms' │ '4.86x faster' │ '10.93ms' │ '10.88x slower' │ | ||
└───────────┴────────────┴──────────────┴───────────────────┴────────────┴────────────────┴───────────┴─────────────────┘ | ||
┌───────────┬────────────┬──────────────┬───────────────────┬─────────────┬─────────────────┬───────────────────┬────────────────────────┬───────────┬─────────────────┐ | ||
│ (index) │ synckit │ sync-threads │ perf sync-threads │ deasync │ perf deasync │ make-synchronized │ perf make-synchronized │ native │ perf native │ | ||
├───────────┼────────────┼──────────────┼───────────────────┼─────────────┼─────────────────┼───────────────────┼────────────────────────┼───────────┼─────────────────┤ | ||
│ loadTime │ '7.24ms' │ '0.80ms' │ '9.02x slower' │ '134.41ms' │ '18.56x faster' │ '1.52ms' │ '4.77x slower' │ '0.45ms' │ '16.24x slower' │ | ||
│ runTime │ '104.63ms' │ '5822.64ms' │ '55.65x faster' │ '3945.29ms' │ '37.71x faster' │ '153.68ms' │ '1.47x faster' │ '9.86ms' │ '10.61x slower' │ | ||
│ totalTime │ '111.87ms' │ '5823.44ms' │ '52.06x faster' │ '4079.69ms' │ '36.47x faster' │ '155.20ms' │ '1.39x faster' │ '10.31ms' │ '10.85x slower' │ | ||
└───────────┴────────────┴──────────────┴───────────────────┴─────────────┴─────────────────┴───────────────────┴────────────────────────┴───────────┴─────────────────┘ |
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,8 +1,7 @@ | ||
$ node benchmarks/benchmark.js | ||
┌───────────┬────────────┬──────────────┬───────────────────┬────────────┬────────────────┬───────────┬─────────────────┐ | ||
│ (index) │ synckit │ sync-threads │ perf sync-threads │ deasync │ perf deasync │ native │ perf native │ | ||
├───────────┼────────────┼──────────────┼───────────────────┼────────────┼────────────────┼───────────┼─────────────────┤ | ||
│ loadTime │ '16.97ms' │ '1.04ms' │ '16.37x slower' │ '9.67ms' │ '1.76x slower' │ '0.56ms' │ '30.19x slower' │ | ||
│ runTime │ '122.19ms' │ '4970.21ms' │ '40.67x faster' │ '633.51ms' │ '5.18x faster' │ '10.47ms' │ '11.67x slower' │ | ||
│ totalTime │ '139.16ms' │ '4971.25ms' │ '35.72x faster' │ '643.18ms' │ '4.62x faster' │ '11.03ms' │ '12.61x slower' │ | ||
└───────────┴────────────┴──────────────┴───────────────────┴────────────┴────────────────┴───────────┴─────────────────┘ | ||
┌───────────┬────────────┬──────────────┬───────────────────┬─────────────┬─────────────────┬───────────────────┬────────────────────────┬───────────┬─────────────────┐ | ||
│ (index) │ synckit │ sync-threads │ perf sync-threads │ deasync │ perf deasync │ make-synchronized │ perf make-synchronized │ native │ perf native │ | ||
├───────────┼────────────┼──────────────┼───────────────────┼─────────────┼─────────────────┼───────────────────┼────────────────────────┼───────────┼─────────────────┤ | ||
│ loadTime │ '14.26ms' │ '1.07ms' │ '13.26x slower' │ '60.57ms' │ '4.25x faster' │ '1.22ms' │ '11.64x slower' │ '0.40ms' │ '35.34x slower' │ | ||
│ runTime │ '118.02ms' │ '6435.42ms' │ '54.53x faster' │ '3745.86ms' │ '31.74x faster' │ '155.31ms' │ '1.32x faster' │ '10.87ms' │ '10.86x slower' │ | ||
│ totalTime │ '132.28ms' │ '6436.49ms' │ '48.66x faster' │ '3806.43ms' │ '28.78x faster' │ '156.54ms' │ '1.18x faster' │ '11.27ms' │ '11.74x slower' │ | ||
└───────────┴────────────┴──────────────┴───────────────────┴─────────────┴─────────────────┴───────────────────┴────────────────────────┴───────────┴─────────────────┘ |
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const { makeSynchronized } = require('make-synchronized') | ||
|
||
/** @type {() => string} */ | ||
const syncFn = makeSynchronized(require.resolve('./native.cjs')) | ||
/** | ||
* @param {string} filename | ||
* @returns {() => string} syncified function | ||
*/ | ||
const syncFn = filename => | ||
makeSynchronized('node:fs/promises').readFile(filename, 'utf8') | ||
|
||
module.exports = syncFn |
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,11 +1,10 @@ | ||
import { makeSynchronized } from 'make-synchronized' | ||
|
||
/** @type {() => string} */ | ||
const syncFn = makeSynchronized(new URL('native.cjs', import.meta.url)) | ||
|
||
/** @type {() => string} */ | ||
// More reasonable test? | ||
// const synchronizeOnFly = filename => | ||
// makeSynchronized('node:fs/promises').readFile(filename, 'utf8') | ||
/** | ||
* @param {string} filename | ||
* @returns {() => string} syncified function | ||
*/ | ||
const syncFn = filename => | ||
makeSynchronized('node:fs/promises').readFile(filename, 'utf8') | ||
|
||
export default syncFn |
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
Oops, something went wrong.