Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0dd53da
deps: add simdjson
anonrig Oct 21, 2023
45e4f82
src: move package resolver to c++
anonrig Oct 25, 2023
9f54987
module: merge config with `package_json_reader`
anonrig Nov 10, 2023
9bf1443
src: omit bool values of package.json main field
anonrig Dec 3, 2023
f2d83a3
benchmark: update iterations in benchmark/util/format.js
Dec 4, 2023
dbee03d
benchmark: update iterations in benchmark/util/inspect-array.js
Dec 4, 2023
b80bb13
benchmark: update iterations in benchmark/util/normalize-encoding.js
Dec 4, 2023
a997205
benchmark: update iterations of benchmark/util/type-check.js
Dec 4, 2023
fdd8c18
benchmark: update interations and len in benchmark/util/text-decoder.js
Dec 4, 2023
4eedf5e
module: fix recently introduced coverity warning
mhdawson Nov 21, 2023
f90fc83
src: fix dynamically linked zlib version
richardlau Dec 4, 2023
58ca66a
doc: deprecate `dirent.path`
aduh95 Dec 4, 2023
06038a4
deps: update libuv to 1.47.0
nodejs-github-bot Nov 10, 2023
95d8a27
deps: cherry-pick bfbe4e38d7 from libuv upstream
abmusse Nov 18, 2023
4ddd0da
test: escape cwd in regexp
kapouer Dec 5, 2023
2b46711
tools: update lint-md-dependencies to [email protected]
nodejs-github-bot Dec 5, 2023
0b61823
deps: update undici to 5.28.2
nodejs-github-bot Dec 5, 2023
c984158
tools: update eslint to 8.55.0
nodejs-github-bot Dec 5, 2023
7a8a2d5
lib: don't parse windows drive letters as schemes
PaperStrike Dec 5, 2023
c3abdc5
src: implement --trace-promises
joyeecheung Dec 5, 2023
7f5291d
test: resolve path of embedtest binary correctly
zcbenz Dec 5, 2023
3f7f3ce
fs: improve error performance of readvSync
IlyasShabi Dec 5, 2023
9950103
deps: update zlib to 1.3-22124f5
nodejs-github-bot Dec 5, 2023
c2b6edf
esm: fix hook name in error message
bmacnaughton Dec 5, 2023
c45a9a3
doc: add deprecation notice to `dirent.path`
aduh95 Dec 5, 2023
b148c43
benchmark: add create-hash benchmark
joyeecheung Dec 5, 2023
4705023
tools: fix simdjson updater
anonrig Dec 1, 2023
429fbb3
deps: update simdjson to v3.6.2
anonrig Dec 1, 2023
c0e5e74
module: document `parentURL` in register options
privatenumber Dec 6, 2023
5f95dca
node-api: introduce experimental feature flags
gabrielschulhof Dec 1, 2023
38fd0ca
benchmark: add undici websocket benchmark
Dec 6, 2023
735bad3
build: fix warnings from uv for gn build
zcbenz Dec 6, 2023
5112306
stream: fix fd is null when calling clearBuffer
kylo5aby Dec 7, 2023
c3c8237
fs: update params in jsdoc for createReadStream and createWriteStream
Dec 7, 2023
539bee4
doc: use length argument in pbkdf2Key
tniessen Dec 7, 2023
838179b
doc: correct tracingChannel.traceCallback()
Flarna Dec 8, 2023
fd028e1
win,tools: upgrade Windows signing to smctl
StefanStojanovic Dec 8, 2023
53b16c7
benchmark: update iteration and size in benchmark/crypto/randomBytes.js
Dec 9, 2023
087fb09
benchmark: update iterations in benchmark/crypto/aes-gcm-throughput.js
Dec 9, 2023
637ffce
doc: add note regarding `--experimental-detect-module`
shubherthi-mitra Dec 9, 2023
048349e
test: fix test runner colored output test
MoLow Dec 10, 2023
cd891b3
util: improve performance of function areSimilarFloatArrays
Septa2112 Dec 10, 2023
1bbdbdf
benchmark: update iterations in benchmark/perf_hooks
Dec 10, 2023
fc55032
src: remove unused headers in `node_file.cc`
Dec 10, 2023
2581fce
bootstrap: improve snapshot unsupported builtin warnings
joyeecheung Dec 10, 2023
d5c9adf
test_runner: fix infinite loop when files are undefined in test runner
pulkit-30 Dec 10, 2023
26ed4ad
doc: deprecate hash constructor
marco-ippolito Dec 10, 2023
297cb6f
tools: update doc to [email protected] [email protected]
nodejs-github-bot Dec 11, 2023
3fb7fc9
quic: further implementation details
jasnell May 29, 2023
7f95926
http: handle multi-value content-disposition header
ArsalanDotMe Dec 11, 2023
9b7f79a
src: fix double free reported by coverity
mhdawson Dec 4, 2023
35e8f26
fs: throw fchownSync error from c++
anonrig Dec 12, 2023
328a417
tools: update lint-md-dependencies to [email protected]
nodejs-github-bot Dec 12, 2023
04eaa5c
doc: run license-builder
github-actions[bot] Dec 13, 2023
aa2be4b
module: load source maps in `commonjs` translator
privatenumber Dec 13, 2023
cc94986
test: handle relative https redirect
richardlau Dec 13, 2023
e178a43
vm: use v8::DeserializeInternalFieldsCallback explicitly
joyeecheung Sep 6, 2023
2cfee53
src: register process_wrap external references
joyeecheung Nov 27, 2023
84e2f51
src: register spawn_sync external references
joyeecheung Nov 27, 2023
abe9052
src: register udp_wrap external references
joyeecheung Nov 27, 2023
aee01ff
test: test syncrhnous methods of child_process in snapshot
joyeecheung Nov 27, 2023
8da9d96
deps: V8: cherry-pick 0fd478bcdabd
joyeecheung Nov 24, 2023
fa25e06
src: implement countObjectsWithPrototype
joyeecheung Nov 3, 2023
ed07075
test: deflake test-diagnostics-channel-memory-leak
joyeecheung Nov 3, 2023
3ccd5fa
test_runner: format coverage report for tap reporter
pulkit-30 Dec 15, 2023
71acd36
stream: implement TransformStream cleanup using "transformer.cancel"
debadree25 Dec 15, 2023
34ddc71
2023-12-19, Version 21.5.0 (Current)
RafaelGSS Dec 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fs: improve error performance of readvSync
PR-URL: #50100
Refs: nodejs/performance#106
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
IlyasShabi authored and RafaelGSS committed Dec 15, 2023
commit 3f7f3ce8c9a148bc3f7be83e0e6ca74a4ea322e6
58 changes: 58 additions & 0 deletions benchmark/fs/bench-readvSync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

const common = require('../common');
const fs = require('fs');
const assert = require('assert');
const tmpdir = require('../../test/common/tmpdir');
tmpdir.refresh();

const exptectedBuff = Buffer.from('Benchmark Data');
const expectedLength = exptectedBuff.length;

const bufferArr = [Buffer.alloc(expectedLength)];

const filename = tmpdir.resolve('readv_sync.txt');
fs.writeFileSync(filename, exptectedBuff);

const bench = common.createBenchmark(main, {
type: ['valid', 'invalid'],
n: [1e5],
});

function main({ n, type }) {
let fd;
let result;

switch (type) {
case 'valid':
fd = fs.openSync(filename, 'r');

bench.start();
for (let i = 0; i < n; i++) {
result = fs.readvSync(fd, bufferArr, 0);
}

bench.end(n);
assert.strictEqual(result, expectedLength);
fs.closeSync(fd);
break;
case 'invalid': {
fd = 1 << 30;
let hasError = false;
bench.start();
for (let i = 0; i < n; i++) {
try {
result = fs.readvSync(fd, bufferArr, 0);
} catch {
hasError = true;
}
}

bench.end(n);
assert(hasError);
break;
}
default:
throw new Error('Invalid type');
}
}
6 changes: 1 addition & 5 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,14 +801,10 @@ function readvSync(fd, buffers, position) {
fd = getValidatedFd(fd);
validateBufferArray(buffers);

const ctx = {};

if (typeof position !== 'number')
position = null;

const result = binding.readBuffers(fd, buffers, position, undefined, ctx);
handleErrorFromBinding(ctx);
return result;
return binding.readBuffers(fd, buffers, position);
}

/**
Expand Down
14 changes: 8 additions & 6 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2467,18 +2467,20 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {
iovs[i] = uv_buf_init(Buffer::Data(buffer), Buffer::Length(buffer));
}

FSReqBase* req_wrap_async = GetReqWrap(args, 3);
if (req_wrap_async != nullptr) { // readBuffers(fd, buffers, pos, req)
if (argc > 3) { // readBuffers(fd, buffers, pos, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
FS_ASYNC_TRACE_BEGIN0(UV_FS_READ, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "read", UTF8, AfterInteger,
uv_fs_read, fd, *iovs, iovs.length(), pos);
} else { // readBuffers(fd, buffers, undefined, ctx)
CHECK_EQ(argc, 5);
FSReqWrapSync req_wrap_sync;
FSReqWrapSync req_wrap_sync("read");
FS_SYNC_TRACE_BEGIN(read);
int bytesRead = SyncCall(env, /* ctx */ args[4], &req_wrap_sync, "read",
uv_fs_read, fd, *iovs, iovs.length(), pos);
int bytesRead = SyncCallAndThrowOnError(
env, &req_wrap_sync, uv_fs_read, fd, *iovs, iovs.length(), pos);
FS_SYNC_TRACE_END(read, "bytesRead", bytesRead);
if (is_uv_error(bytesRead)) {
return;
}
args.GetReturnValue().Set(bytesRead);
}
}
Expand Down