in reply to Re: notequal very slow
in thread notequal very slow

Hi Joost, Some of the string is indeed very long (almost 40 characters long) but most of the strings being compared is manageable length. Any magic I can do with perl that will make perl work faster in just that part of the code? :-)

Replies are listed 'Best First'.
Re^3: notequal very slow
by Joost (Canon) on Jan 15, 2008 at 19:47 UTC
    40 characters really isn't very long at all. Especially considering that comparing strings means you generally don't have to check the whole string:

    "b1234872938741279834712987398127398712983798123" eq "b2137298379812739812739871239871289379812739817" can be tested to be false after comparing only 2 characters, for example.

    In any case, I may be able to help you optimize things, but since I suspect the performance issue is somewhere else in your code you'll have to convince me that your analysis of the problem is correct. Showing that the slowness is in any way significant will help too - It's pointless to spend half an hour speeding up a program that won't take more than a minute of CPU time in its entire useful life :)

Re^3: notequal very slow
by runrig (Abbot) on Jan 15, 2008 at 19:46 UTC
    40 characters is not very long. Thousands or millions might be considered long. Maybe the code inside the if{...} block (not the conditional itself) is the culprit? How are you measuring this?