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

Skip ATA drive selection when not needed #576

Merged
merged 4 commits into from
Feb 24, 2024
Merged

Skip ATA drive selection when not needed #576

merged 4 commits into from
Feb 24, 2024

Conversation

vinc
Copy link
Owner

@vinc vinc commented Feb 11, 2024

We don't need to do the operations to select the drive when it has not changed between operations.

@vinc
Copy link
Owner Author

vinc commented Feb 11, 2024

Here is a disk benchmark in lisp:

(load "/lib/lisp/core.lsp")

(var path "/tmp/bench.tmp")

(var buf '(0))
(var i 0)
(var n1 (str->num (first args)))
(print (str "Creating a " (^ 2 n1) " bytes buffer"))
(while (< i n1) (do
  (set buf (concat buf buf))
  (set i (+ i 1))))

(var i 0)
(var n2 (str->num (second args)))
(print (str "Writting buffer to file " n2 " time(s)"))
(var t1 (realtime))
(while (< i n2) (do
  (write-binary path buf)
  (set i (+ i 1))))
(var t2 (realtime))
(var t (- t2 t1))

(print "")
(print (str "Duration:    " t " s"))
(print (str "Performance: " (/ (/ (* (^ 2 n1) n2) 1024) t) " KB/s"))

@vinc
Copy link
Owner Author

vinc commented Feb 11, 2024

Here is a few runs before the change:

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    4.790879487991333 s
Performance: 133.58716319293853 KB/s

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    4.741887092590332 s
Performance: 134.96736373163827 KB/s

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    5.112830638885498 s
Performance: 125.17527866706496 KB/s

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    4.918012380599976 s
Performance: 130.13387329495148 KB/s

And here is after the change:

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    3.803030014038086 s
Performance: 168.28686537775786 KB/s

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    3.593909502029419 s
Performance: 178.0790528082588 KB/s

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    3.6830482482910156 s
Performance: 173.76910560348176 KB/s

~
> lisp bench-disk.lsp 16 10
Creating a 65536 bytes buffer
Writting buffer to file 10 time(s)

Duration:    3.854869842529297 s
Performance: 166.0237637440118 KB/s

Still slow but it's a 30% improvement on QEMU

@vinc vinc marked this pull request as ready for review February 24, 2024 13:42
@vinc vinc merged commit 86e43e0 into trunk Feb 24, 2024
1 check passed
@vinc vinc deleted the feature/ata-caching branch February 24, 2024 13:44
@vinc vinc mentioned this pull request Mar 19, 2024
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.

1 participant