Commit 864a9a1
committed
Use hash func to boost file creation and lookup
Introduce a hash-based mechanism to speed up file creation and lookup
operations. The hash function enables faster access to extent and logical
block extent index, improving overall filesystem performance.
hash_code = file_hash(file_name);
extent index = hash_code / SIMPLEFS_MAX_BLOCKS_PER_EXTENT
block index = hash_code % SIMPLEFS_MAX_BLOCKS_PER_EXTENT;
Use perf to measure:
1. File Creation (random)
Legacy:
259.842753513 seconds time elapsed
23.000247000 seconds user
150.380145000 seconds sys
fnv1a:
172.464862354 seconds time elapsed
16.456851000 seconds user
117.377930000 seconds sys
full_name_hash:
222.274028604 seconds time elapsed
20.794966000 seconds user
151.941876000 seconds sys
hash64:
210.738022828 seconds time elapsed
20.578577000 seconds user
138.393533000 seconds sys
2. File Listing (random)
Legacy:
min time: 0.00171 s
max time: 0.03799 s
avg time: 0.00423332 s
tot time: 129.539510 s
fnv1a:
min time: 0.00163 s
max time: 0.07574 s
avg time: 0.00247343 s
tot time: 75.686920 s
full_name_hash:
min time: 0.00171 s
max time: 0.03588 s
avg time: 0.00305601 s
tot time: 93.514040 s
hash64:
min time: 0.00167 s
max time: 0.07705 s
avg time: 0.00261552 s
tot time: 80.034760 s
3. files Removal (Random)
Legacy :
106.921706288 seconds time elapsed
16.987883000 seconds user
91.268661000 seconds sys
fnv1a:
94.012202913 seconds time elapsed
20.617263000 seconds user
73.219170000 seconds sys
full_name_hash:
86.132655220 seconds time elapsed
19.180209000 seconds user
68.476075000 seconds sys
hash64:
85.684199320 seconds time elapsed
16.643633000 seconds user
70.499664000 seconds sys1 parent d1cf3ba commit 864a9a1
5 files changed
+340
-184
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
| 9 | + | |
6 | 10 | | |
7 | | - | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
25 | 53 | | |
26 | 54 | | |
27 | 55 | | |
| |||
34 | 62 | | |
35 | 63 | | |
36 | 64 | | |
37 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
38 | 69 | | |
39 | | - | |
| 70 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments