in reply to Making CSV Files from Tab Delimited Files

... I'm ... concerned about why these regexs are so expensive.
... 98% of run time is tied to these regexs.

We see data being read and munged in the code shown in the OP. The inference I draw from the OP is that the only code not shown is to open the file, write the munged data and close the file. As such, there's almost nothing happening other than data munging done by regexes and, as jwkrahn points out, a possibly expensive string prepend. I don't understand why one would expect the great majority of time to be spent other than in regex execution given the length of the strings involved.

... my substitutions ... are slow.

But what does 'slow' mean? A day? An hour? A minute? My guess is that the regexes shown in the OP would take on the order of a minute or so per file. Is this MajingaZ's experience? How fast do they need to be?

  • Comment on Re: Making CSV Files from Tab Delimited Files