PsIni icon indicating copy to clipboard operation
PsIni copied to clipboard

Slow writing & performance regression in V4

Open HighPriest opened this issue 1 year ago • 1 comments

Issue

I am parsing a big repository with hundreds of ini files. It takes quite a while to go through each file, so the total execution gets unbearably long.

I've measured time of execution of each portion of the code I've written & I've noticed that:

  • Reading file contents & converting into hashtable is quite fast
  • Modifying the hashtable or maping it to another variable is plenty fast
  • Writing to file with Export-Ini takes a significant portion of execution time

I've also noticed a regression in execution time between v3 & v4, of around 100ms (in context of entire script)

Solution

I believe the slow execution of export, comes from generating I/O operation for each output line, using Out-File.
Even for append operation, it should be faster to read the file we are appending into buffer, append chunk of data in memory & then write entire buffer back into file.

HighPriest avatar Oct 08 '24 21:10 HighPriest

Solution proposed in #80

HighPriest avatar Oct 10 '24 02:10 HighPriest