v5 performance analysis

I wonder why lower noi does not translate into faster runtime?  The case is v5 noi is 60% of som42 but v5 runtime is only 90% of som42. Why 40% saving in noi reduce the runtime only 10%?

The obvious answer is that v5 instruction is more expensive to execute than som42 instruction.  Here is the profile of queen2

v5

queen2  92 sol (no out)noi 133352

running time under profiler
queen2 100x hp  310 ms

(x1000)
 13,335 switch op
  2,464 ldx
  1,443 stx
    744 jmp
    205 jne
  2,464 jlt
    205 call
        inside call
          411  pass param
        1,234  save reg
    205 ret
        inside ret
        1,234  restore reg
  1,930 add
  1,703 sub
    196 mov
  1,771 efor

note:  call/ret saving/restoring reg is expensive.  one call costs 5 times as much as other instruction.


Mips  13335/310 = 43 
(call+ret)/all = 410/13335 = 3%

som-v42

noi  227305
runtime 407 436 401 ms

(x1000)
22,730 switch op
 1,920 add
   753 sub
   205 eq
 2,464 ge
     9 addi
   753 subi
 1,784 get
 1,215 put
     9 ld
     9 st
   892 ldya
 1,572 ldy
 1,443 sty
 1,089 jmp
 2,670 jf
   205 call
   205 ret
 1,771 jle
 1,574 inc
 2,179 lit

Mips 22730/401 = 56
(call+ret)/all = 410/22730 = 1.8%

The first conclusion, v5 instruction is more expensive than som42 because v5 Mips is 43, som42 Mips is 56.

22 Nov 2009






