Writing to a file many times with fprint
is very slow
#1945
hotgluebanjo
started this conversation in
General
Replies: 1 comment 2 replies
-
@hotgluebanjo This only takes a few ms on my Linux machine, but I can guess that the reason is the same on windows: If we observe the syscall trace, C will buffer the writes into chunks:
Odin (by default) will not do so, issuing a
You can do the same buffering in Odin, and you should get similar results as C, etc.:
Which will run much faster (microseconds), with a similar syscall profile:
I would give that a try, then we can maybe investigate further if there is still a significant difference 😺 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure if this is a real issue or if I'm doing something wrong, but something like this takes about 21 seconds:
Run with:
Whereas C takes about 30 milliseconds for what I think is the equivalent example.
Rust and Python are close to C. Optimizing doesn't help.
Only tested on Windows. Both nightly and stable do this. Anyone have any idea?
Beta Was this translation helpful? Give feedback.
All reactions