0

The code is:

def slide_merge_forloop(rc1u,rc2wr):
    ret1 = []
    rc1ulen = len(rc1u)
    rc2wrlen = len(rc2wr)

    for i in xrange(min (rc1ulen, rc2wrlen)):
        if rc1u[i] == rc2wr[i]:
            ret1.append(rc1u[i])
        elif rc1u[i] == 'N':
            ret1.append(rc1u[i])
        elif rc2wr[i] == 'N':
            ret1.append(rc2wr[i])
        else:
            break
    return ret1

Below is the output from profiling this function as part of the main code, gained whilst using profilehooks as the profiling tool:

*** PROFILER RESULTS ***
slide_merge_forloop (Early_matcher.py:73)
function called 224794 times

         1181922 function calls in 1.004 seconds

   Ordered by: cumulative time, internal time, call count

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   224794    0.817    0.000    0.980    0.000 Early_matcher.py:73(slide_merge_forloop)
   224794    0.097    0.000    0.097    0.000 {min}
   449588    0.052    0.000    0.052    0.000 {len}
   224794    0.024    0.000    0.024    0.000 {method 'disable' of '_lsprof.Profiler' objects}
    57952    0.014    0.000    0.014    0.000 {method 'append' of 'list' objects}
        0    0.000             0.000          profile:0(profiler)

Obviously I wish to speed up the code but the part I have issue with is what does the {min} part mean? I dont call such thing at all during this part of my code and yet it is taking up a significant amount of time. I have the same issue with the "method 'disable' " section as I do not understand what that is either.

Any help in understanding this output would be greatly appreciated.

Tom
  • 469
  • 4
  • 7
  • 16
  • this type of question should be places in http://codereview.stackexchange.com/ – sundar nataraj Jul 18 '14 at 12:13
  • Isnt that for if you want help optimising your code? I dont want peoples help with that, I just need to understand what profilehooks means by these statements and figured if I put my code up then people can state "this line does this therefore the statmeent refers to this process". – Tom Jul 18 '14 at 12:19
  • 1
    "Obviously I wish to speed up the code" [*This works better.*](http://stackoverflow.com/a/4299378/23771) – Mike Dunlavey Jul 18 '14 at 12:32
  • Thanks for that, makes sense to identify which section likely takes up the time identified and work from there. – Tom Jul 18 '14 at 12:35

1 Answers1

0

It means the time spent executing the min built-in function

Mike Burrows
  • 236
  • 3
  • 7