in reply to Re^3: Faster Hash Slices
in thread Faster Hash Slices

so that the loop is in effect useless, it would be faster to go straight to the last line of the file, split it and run the discussed command only once.

What "discussed command"? The OP doesn't mention any command; nor show any "command".

You appear to be assuming that the op reads all the lines of the file; and then runs this "discussed command" once the rad loop ends; but there is no evidence of that within the thread.

An alternative scenario: He reads a line; splits it to the hash; accesses a few named fields and performs some calculation that affects some variables declared before the loop is entered; and then loops back and reads the next line; until the file is read.

There is no evidence from the OP one way or the other anywhere in the thread, but to assume your version is to assume the OP is ...


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^5: Faster Hash Slices
by Laurent_R (Canon) on Nov 30, 2013 at 19:05 UTC

    Well, quite possible, I may have misinterpreted the OP. However the OP specifically said:

    I have a program that reads and processes approximately 8 million line +s of data. For each line read it does: my @aa = split(/\t/); @{$ref}{@head} = @aa;
    It seems to indicate that the program is executing the two lines of code above for each of the 8 million lines of input. Quite possibly the program may be doing something else, but this was just exactly what I was asking for, more code if any.