I have designed a C# console application to merge and split huge files (about 4GB of size) using OOP design. It involves reading/writing xml, flat-files, and images. I have classes for readers and writers.
The merging took about 00:12, while the splitting took more than 04:30 hours. Then I've enhanced the performance of the splitting to reach 00:50 by distributing the output files into subdirectorys rather than using single directory.
My boss's asking me to convert everything into static procedural programming, but not objects. He says 00:12 for merging comparing to 00:50 for splitting is not balanced. He wants to have the splitting done in 00:30 minutes by converting into static.
Now i know static calls are faster according to this. However I disagree that all static will be better since i will have to use "ref" and "out" parameters in methods.
My questions are:
- What is the reason for splitting files into subdirectory is much more faster than using a single output directory? (i.e. for huge number of files >200,000)
- Is there a better way than converting my code from object to static, in order to achieve higher performance?
Finally, though you haven't given much information, I see no reason to think this "unbalance" is odd. Writing is slower, sometimes significantly so.