You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The postprocessing costs around 0,050ms - 0,100ms of extra time
The debugger costs around 0,100ms of extra time
Currently, we are using .readLine() and then go through that line again and check it char by char. Instead of going through it twice maybe there is a way of going through it only once.
Research (write)
The java.nio.channels package, specifically the FileChannel class provides methods for reading/writing stuff at specific positions of the file. This may drastically increase the writing speed for bigger files, since we would only write the changes instead of the whole file.
Possible logic for the above:
Check if the file is empty. If it is simply parse and write all modules to it. Otherwise, continue:
During read attach the keys and values start/end positions to the module. Now if the module was modified, aka the value/key was changed we write to those specific positions only.
There are however some negative aspects to this approach:
Extra memory needed to store each keys/values positions
The more time passes between read and write, the more likely it is that the file was changed in between and thus the positions are not accurate anymore which could lead to breaking the yaml file
We would need to recalculate the position of all keys/values with each modification I think
The above would not work for Input-/Output- Streams
We would also need to store the old/unmodified value/key to recalculate the location
The text was updated successfully, but these errors were encountered:
To run this benchmark yourself simply clone this repo and run this test: https://github.com/Osiris-Team/Dream-Yaml/blob/d06e9d1a4985c985f9b3f589875d818938e2bb8d/src/test/java/YamlBenchmarks.java#L46
Research (read)
Research (write)
The
java.nio.channels
package, specifically theFileChannel
class provides methods for reading/writing stuff at specific positions of the file. This may drastically increase the writing speed for bigger files, since we would only write the changes instead of the whole file.Possible logic for the above:
There are however some negative aspects to this approach:
The text was updated successfully, but these errors were encountered: