Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Humble Initiate seeks guidance of the Gurus and Wizards.

I need to process 2500 Autocad DXF files(text files one item per line) with line counts from 10k to 500k. The file sizes are from 150k to 8M.

Slurping a 270k row DXF into an array takes 14 seconds(wall clock). Opening the same file in Textpad takes less than 1sec. What am I missing? Thanks.

ps Box is W2K, XP1700+, 512MB

Replies are listed 'Best First'.
Re: hudsonk
by Kanji (Parson) on Mar 23, 2002 at 02:40 UTC

    Slurping a 15MB file into an array (longest line 357K) only took 3 wallclock seconds on my lowly PII300, so I think you really need to show us what you're doing, like BeernuT and crazyinsomniac ask.

    One thing I will say though, is: the fastest way to read a file isn't the most obvious:

    Using that method, I can read the whole file into a scalar in 0 wallclock seconds! :)

        --k.


Re: hudsonk
by crazyinsomniac (Prior) on Mar 23, 2002 at 02:13 UTC
Re: hudsonk
by rjray (Chaplain) on Mar 23, 2002 at 04:42 UTC

    In addition to the numerous admonitions you've already gotten for not posting any code in the first place, let me add this: you don't know that Textpad is reading the entire 270k-row file in that 1 second of start-up time. There's no reason for it to read more data than it can display on the initial page prior to setting up the basic display. It can then read the rest of the file in the background, or on an as-needed basis. Plus, as others have pointed out, Textpad is a binary, and a Perl script has to go through a compilation phase first.

    --rjray

Re: hudsonk
by BeernuT (Pilgrim) on Mar 23, 2002 at 01:33 UTC
    All I can say is. Can we see some code?
    It will really help us in giving pointers to you.

    -bn