9P Filesystem Performance Issue
- Dominant language
- JavaScript
- Stars
- 23.5k
- Forks
- 1.9k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
Hi,
I have been testing the 9P filesystem in v86 and noticed even the in-memory implementation is much slower than the root file system.
This is the script I used to create test files.
```
#!/bin/sh
ROWS=500
COLS=5
for i in $(seq 1 $ROWS); do
for j in $(seq 1 $COLS); do
mkdir -p "row/$i/col/$j"
echo "Content" > "row/$i/col/$j/data.txt"
done
done
```
This is the script I used for benchmarking.
```
time cat /mnt/row/*/col/*/data.txt
real 0m 1.92s
user 0m 0.00s
sys 0m 1.00s
time cat /row/*/col/*/data.txt
real 0m 0.16s
user 0m 0.00s
sys 0m 0.00s
```
Performance Profiling for 9P with Chrome DevTools
Performance Profiling for the root file system with Chrome DevTools
The profiling results show that when performing 9P operations most of the time is spent on `Function call` and `postMessage`.
`Function call` corresponds to `this.yield_callback`.
https://github.com/copy/v86/blob/db22e06746d7adfd3b8c01be29fd15dea4b3bd37/src/main.js#L144-L150
`postMessage` corresponds to `worker.postMessage`.
https://github.com/copy/v86/blob/db22e06746d7adfd3b8c01be29fd15dea4b3bd37/src/main.js#L152-L155
I understand 9P is expected to be slower, but any pointers on how to improve its performance, as I'm trying to implement a custom 9P filesystem myself.
Thanks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the reported comparison with the file-creation and benchmark scripts in the issue, then inspect src/main.js around lines 144-155. Profile the 9P path and compare yield_callback and worker.postMessage costs with the root filesystem; done requires an agreed performance improvement backed by updated benchmark results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- operating-systems, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100