I've noticed that fs.writeFile is about 4 times slower than fs.readFile when using strings and utf8 encoding. After some debugging, it seems that the bottleneck comes from the RN bridge (added timers on native and the actual write operation is very fast).
I'm reading/writing the same amount of data, so I wonder what's causing such a timing difference between read and write if the bottleneck is the RN bridge.
Lastly, is there a better approach to write a big string to disk? I'm trying to write a JSON object to a file so the source is JS. I don't think there's a way to bypass the bridge for such write/read.
Hello all,
I've noticed that
fs.writeFile
is about 4 times slower thanfs.readFile
when using strings andutf8
encoding. After some debugging, it seems that the bottleneck comes from the RN bridge (added timers on native and the actual write operation is very fast).I'm reading/writing the same amount of data, so I wonder what's causing such a timing difference between read and write if the bottleneck is the RN bridge.
Lastly, is there a better approach to write a big string to disk? I'm trying to write a JSON object to a file so the source is JS. I don't think there's a way to bypass the bridge for such write/read.
Thanks.