I had two big text files to compare, each file contains about 100,000 lines, each line represent a single entity in the db, and it's data.
Using c#. To compare initially, I just spitted the file by lines, then second spitted each line into a dictionary, and then compare the values by the key from each file content. This was working fine, but looked to me a little awkward since each line is 'stupid' and I have less control on what each split is representing, aliasing, etc. Then I decided to represent each line as an object, with naming, properties, etc,. since then, it's cleaner code, easier to control, but performance wise, it takes about 8 minutes compare to less than a minute with the previous way.
I wanted to know, If moving to creating objects out of every line is the right way (programming wise), or in cases like this, 'stupid' splitting, looping and comparing text will be the 'cleaner' way ?
Update of the purpose: I changed my code to objecting the lines, because each splitting in line has it's own 'settings' for example, one line will be an amount that looks like 00100, then i want to parse it to int and only then to compare, some splits are 'to ignore', each split also has a name (base amount, company, etc), so I want to report the name of the split if there's a difference.. My doubt is, if changing code that runs in like 20 seconds, to a code that runs in 10 minutes, but makes my life easier, is the right thing?