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

perf: fs optimizations - part 1 #15873

Merged
merged 24 commits into from
Sep 22, 2022
Merged

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Sep 12, 2022

  • Flatten op arguments.

    As a result, truncateSync becomes 2.3x faster.

    # main
    () => truncateSync("test", 0)
    time 1029 ms rate 97181
    time 1013 ms rate 98716
    time 745 ms rate 134228
    
    # This patch
    () => truncateSync("test", 0)
    time 469 ms rate 213219
    time 447 ms rate 223713
    
  • ~8x faster way to serialize op_stat_sync result to JS.

    # main
    () => lstatSync("test")
    time 767 ms rate 130378
    time 767 ms rate 130378
    time 745 ms rate 134228
    
    # This patch
    () => lstatSync("test")
    time 99 ms rate 1010101
    time 99 ms rate 1010101
    time 98 ms rate 1020408
    
  • ~14x faster file copy on MacOS using APFS' clonefile

    # main
    () => copyFileSync("test", "test2")
    time 8646 ms rate 1156
    time 7578 ms rate 1319
    
    # This patch
    () => copyFileSync("test", "test2")
    time 738 ms rate 13550
    time 647 ms rate 15455
    
  • Fast path for perms.read.check / perms.write.check to avoid resolve_from_cwd when possible. It's quite literally a bool check when run with -A, making it infintely faster than before.

runtime/js/30_fs.js Show resolved Hide resolved
runtime/js/30_fs.js Outdated Show resolved Hide resolved
runtime/ops/fs.rs Outdated Show resolved Hide resolved
runtime/js/30_fs.js Show resolved Hide resolved
runtime/ops/fs.rs Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

The struct writer should accept a Uint32Array -> &mut [u32]

runtime/js/30_fs.js Show resolved Hide resolved
runtime/js/30_fs.js Show resolved Hide resolved
runtime/ops/fs.rs Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM

@littledivy littledivy merged commit 698a340 into denoland:main Sep 22, 2022
dsherret pushed a commit to dsherret/deno that referenced this pull request Sep 22, 2022
@littledivy littledivy deleted the fs_optimizations branch March 31, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants