On 1 February 2010 00:28, <clanc...@cybec.com.au> wrote: > > I use Dreamweaver as my editor, mainly because I'm familiar with it, although > I only use > about 1% of its capabilities. However it generally handles long files well. > The other day > I downloaded the two shortest of Brian Dunning's sets of test data *. I > opened the > shortest in Dreamweaver, had a quick look at it, and realised I would have to > replace the > quote, comma, quote separators with semicolons, as part of converting the > files to my > format. > > So I thought I would do that while I was working out what else I had to do. I > entered the > old separator and the replacement in the 'Find and replace' window, then hit > 'Replace > all', expecting the job be done in a few seconds. First I thought nothing was > happening, > but then I realised it was trudging through the file, as if it was wading > through waist > high molasses. > > So I closed the results window, and opened another file, but a few seconds > later focus > switched back to the original file. I tried a couple of times more, but each > time it > returned to the original window. I watched in morbid fascination for a bit, > then decided I > would let it go, just to see how long it took. > > The file contained 500 lines, and was about 80 K. It was taking five seconds > to process > each line, and eventually finished in about 40 minutes. > > The problem appeared to be the results processing. I have only looked at the > results list > about twice, out of idle curiosity, but never saw any thing that I thought > could be > remotely useful. I would like to be able to turn results logging off > altogether, as it > wastes real estate (and time!), but this appears to be impossible. > > On this occasion the program was apparently writing a new line every time it > replaced a > separator (9 times in each line), and then when it finished processing a line > it would > erase all the intermediate result lines, and write a new one for the whole > line. At the > same time it reopened the results window if I had closed it, and return focus > to the file > being processed. > > I then wrote a PHP program to read the file, split it, clean up and > re-arrange the various > elements, enter them into an array in my format, and finally save it as a > file my program > could handle. > > After I had got this running on the 500 line file I used it to process the > 5000 line > file. The whole process was done in the blink of an eye -- literally a > fraction of a > second. > > > * http://www.briandunning.com/sample-data/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
And the moral of the story is "Be happy that you learnt PHP!". -- ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php