summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-08-08 17:56:12 +0100
committerdiogo464 <[email protected]>2025-08-08 17:56:12 +0100
commitb0a6b4604899dbbe500cdc8e2b3cab9bf7d8f197 (patch)
tree628fa297d4375329d5f55eed43dd66182f353c6f
parent29b3cf6098527154bd34245ee26cd1967cf8f262 (diff)
perf: exit(0) on view command to avoid destructors
it is unecessary to run destructures since the OS will cleanup everything for us and it saved a bit of time. Benchmark 1: ./fctdrive-noexit view Time (mean ± σ): 37.0 ms ± 1.2 ms [User: 29.4 ms, System: 7.4 ms] Range (min … max): 35.7 ms … 40.8 ms 81 runs Benchmark 2: ./fctdrive-exit view Time (mean ± σ): 34.7 ms ± 1.3 ms [User: 26.9 ms, System: 7.6 ms] Range (min … max): 33.0 ms … 38.5 ms 83 runs Summary ./fctdrive-exit view ran 1.07 ± 0.05 times faster than ./fctdrive-noexit view
-rw-r--r--fctdrive/src/main.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/fctdrive/src/main.rs b/fctdrive/src/main.rs
index 2035680..91e5046 100644
--- a/fctdrive/src/main.rs
+++ b/fctdrive/src/main.rs
@@ -859,6 +859,7 @@ fn cmd_view(args: ViewArgs) {
859 ops.iter().for_each(|op| apply(&mut fs, op).unwrap()); 859 ops.iter().for_each(|op| apply(&mut fs, op).unwrap());
860 write_node(&mut writer, &fs, fs.root, Default::default()); 860 write_node(&mut writer, &fs, fs.root, Default::default());
861 writer.flush().unwrap(); 861 writer.flush().unwrap();
862 std::process::exit(0);
862} 863}
863 864
864fn write_node(writer: &mut FsNodeWriter, fs: &Fs, node_id: FsNodeId, path: DrivePath) { 865fn write_node(writer: &mut FsNodeWriter, fs: &Fs, node_id: FsNodeId, path: DrivePath) {