Skip to content

fs: improve error performance of writevSync - #50038

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
IlyasShabi:writev-sync
Oct 12, 2023
Merged

fs: improve error performance of writevSync#50038
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
IlyasShabi:writev-sync

Conversation

@IlyasShabi

@IlyasShabiIlyasShabi commented Oct 4, 2023

Copy link
Copy Markdown
Member

Local benchmark:

 confidence improvement accuracy (*) (**) (***)
fs/bench-writevSync.js n=100000 type='invalid' *** 125.24 % ±2.51% ±3.34% ±4.37%
fs/bench-writevSync.js n=100000 type='valid' *** -0.26 % ±3.07% ±4.10% ±5.34%

Ref: nodejs/performance#106

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Oct 4, 2023
@IlyasShabi

Copy link
Copy Markdown
MemberAuthor

Feel free to suggest improvements in the benchmark file

@Uzlopak

Copy link
Copy Markdown
Contributor

Afaik in c++ returning a value is slower than modifying a variable passed as parameter (by ref).

Comment threadbenchmark/fs/bench-writevSync.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an invalid type to benchmarks

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anonrig I would appreciate help creating a good bench script for my first PR 🙏

Comment threadlib/fs.js Outdated
Comment threadsrc/node_file.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs to be updated.

Comment threadbenchmark/fs/bench-writevSync.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to remove dead code elimination store the result of this operation and assert it when the benchmark finishes.

Comment threadlib/fs.js Outdated
Comment threadsrc/node_file.cc Outdated
@mscdex

mscdex commented Oct 4, 2023

Copy link
Copy Markdown
Contributor

Did you swap the old and new node binary parameters when comparing the benchmarks or is that actually a 58% performance regression?

@anonriganonrig added the needs-benchmark-ci PR that need a benchmark CI run. label Oct 4, 2023
Comment threadsrc/node_file.cc Outdated
@mscdex

Copy link
Copy Markdown
Contributor

FWIW the changes currently result in:

fs/bench-writevSync.js n=100000 type='valid' -0.83 % ±7.81% ±10.40% ±13.55%

I'm guessing this should instead be more about improving the error case?

Comment threadbenchmark/fs/bench-writevSync.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a try/catch on valid part

Comment threadbenchmark/fs/bench-writevSync.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a file descriptor. The variable name suggests fd

@IlyasShabiIlyasShabi changed the title fs: improve writevSync performancefs: improve error performance of writevSyncOct 7, 2023
@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 7, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 7, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@anonriganonrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. review wanted PRs that need reviews. labels Oct 8, 2023
@anonriganonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 12, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 12, 2023
@nodejs-github-bot
nodejs-github-bot merged commit bf0f078 into nodejs:mainOct 12, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in bf0f078

targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50038
Refs: nodejs/performance#106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@targostargos mentioned this pull request Nov 12, 2023
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 2024
PR-URL: nodejs#50038
Refs: nodejs/performance#106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.fsIssues and PRs related to the fs subsystem / file system.needs-benchmark-ciPR that need a benchmark CI run.needs-ciPRs that need a full CI run.review wantedPRs that need reviews.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@IlyasShabi@Uzlopak@mscdex@nodejs-github-bot@anonrig@pluris@ilyasShabiCS