MCPcopy Index your code
hub / github.com/python/cpython / factorial

Function factorial

Lib/test/profilee.py:35–46  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

33 factorial(14) # 130
34
35def factorial(n):
36 # 23 calls total
37 # 170 ticks total, 150 ticks local
38 # 3 primitive calls, 130, 20 and 20 ticks total
39 # including 116, 17, 17 ticks local
40 global TICKS
41 if n > 0:
42 TICKS += n
43 return mul(n, factorial(n-1))
44 else:
45 TICKS += 11
46 return 1
47
48def mul(a, b):
49 # 20 calls

Callers 6

testfuncFunction · 0.70
helper2_indirectFunction · 0.70
test_factorialMethod · 0.70
test_permMethod · 0.70
test_combMethod · 0.70

Calls 1

mulFunction · 0.70

Tested by 4

test_factorialMethod · 0.56
test_permMethod · 0.56
test_combMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…