in reply to Re^2: notequal very slow
in thread notequal very slow
You need to profile your code. Going by how long print statements seem to take is about as useful as checking wind speed with a wetted finger. For a start, unless you have disabled output buffering, when you see output can be completely unrelated to when your program executed the print statement. In extreme cases, it could be displayed hours later.
The reason for the loops question is that the statement contains two fairly heavily indirected references. In high iteration count tight loops it can make sense to remove invarient parts of such statements from the loop through the use of temporary variables, but without profiling, random tuning is pointless.
It's like trying to improve the performance of your family saloon by polishing the paintwork, whilst ignoring the two hundred weight of junk in the boot and the roof rack.
Grab Devel::Smallprof which will quickly and easily allow you to see exactly where any perfomance bottleneck exist, on a line-by-line basis.
|
|---|