REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.35 KB
Close
/proc/thread-self/root/lib/node_modules/npm/node_modules/lockfile/speedtest.js
Text
Base64
const path = require('path'); const async = require('async'); const lf = require('lockfile'); const fs = require('fs'); const n = +process.argv[3] || 300; const a = Array.apply(null, {length: n}).map(function(_, i) { return i }) const file = path.resolve(__dirname, 'speed-test.lock'); try{ fs.unlinkSync(file); } catch(e){} /// NOTE: this should run in about 30ms on a SSD Ubuntu 16.04, that is fast, because we are locking/unlocking 300 locks /// *HOWEVER* if we change async.eachSeries to async.each, lockfile will barf immediately, and I can't get lockfile /// to not barf, using any of the options {} available to lockfile#lock. const parallel = process.argv[2] === 'parallel'; var fn, msg; if(parallel){ msg = 'parallel'; fn = async.each; } else{ msg = 'series'; fn = async.eachSeries; } const start = Date.now(); console.log(' => locking/unlocking ' + a.length + ' times, in ' + msg); fn(a, function (val, cb) { console.log('try %d', val) lf.lock(file, { retries: n * 3 }, function (err) { if (err) { cb(err); } else { console.log('complete %d', val) lf.unlock(file, cb); } }); }, function complete(err) { if (err) { throw err; } console.log(' => Time required for lockfile => ', Date.now() - start, 'ms'); process.exit(0); });
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.travis.yml
126 B
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CHANGELOG.md
1.78 KB
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
gen-changelog.sh
238 B
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE
765 B
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
lockfile.js
8.22 KB
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package.json
1.69 KB
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
2.03 KB
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
sockets.md
700 B
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
speedtest.js
1.35 KB
lrw-r--r--
2021-03-10 14:36:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).