Call it stubbornness or simply curiousity... I was just not happy with a system io approach of loading a treeview with the folders in a specified directory with a file listing on the right. Even with a load on demand approach where you click a node and it then loads its folders and files seemed fairly slow to me.
I through a component together that builds a folder object with all folders and files... and can be serialized/deserialized to/from xml.
Now for the tests:
I decided to appease myself and see which was really faster...
System.IO or Serialization
1) First I timed the component alone to see how long it would take to load the object using system.io
Results:
- 8 Folders 25 Files loaded in an average of 546,903 Ticks (100 nanosecond intervals)
2) Second I timed the component to see how long it would take to load the same object by deserializing the xml file into the object
Results:
- 8 Folders 25 Files loaded in an average of 4,531,482 Ticks (100 nanosecond intervals)
I was quite surprised that the system.io was marginally faster then the deserialization. I decided to up the ante to a larger folder...
1) System.IO
Results:
- 1320 Folders 8318 Files loaded in an average of 39,064,500 Ticks (100 nanosecond intervals)
- Converted to seconds (3.90645 seconds)
2) Deserialization
Results:
- 1320 Folders 8318 Files loaded in an average of 6,198,234 Ticks (100 nanosecond intervals)
- Converted to seconds (0.6198234 seconds)
CONCLUSION:
The thing to notice here is the marginal increase in time to load the object when deserializing. The increase was equivalent to 0.15 seconds... while System.IO was very fast for small folders when the numbers increased the time required to load the object also did exponentially.