Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The final fsync makes it 16 times slower #155

Open
1 task done
davidfirst opened this issue Mar 30, 2023 · 0 comments
Open
1 task done

The final fsync makes it 16 times slower #155

davidfirst opened this issue Mar 30, 2023 · 0 comments
Labels
Bug thing that needs fixing Needs Triage needs an initial review

Comments

@davidfirst
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm writing 6,700 files.
If I pass fsync: false to the options, it takes 9 seconds.
If I don't, it defaults to true, and it takes 152 seconds (!).

From the docs I see this:

If the fsync option is false, writeFile will skip the final fsync call.

Could you explain how important this final fsync call is? I'm considering to disable it.

Expected Behavior

I wish to have it faster, or understand whether it's safe to cancel the fsync.

Steps To Reproduce

try to write lots of files ( > 1000) to see the issue clearly.

Environment

  • npm: 8.1.2
  • Node: v16.13.2
  • OS: Mac OS 12.6
  • platform: Mac
@davidfirst davidfirst added Bug thing that needs fixing Needs Triage needs an initial review labels Mar 30, 2023
davidfirst added a commit to teambit/bit that referenced this issue Mar 31, 2023
Writing object files is 16 times faster with this change. See
npm/write-file-atomic#155 for more info.
@davidfirst davidfirst changed the title final fsync makes it 16 times slower The final fsync makes it 16 times slower Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs an initial review
Projects
None yet
Development

No branches or pull requests

1 participant