Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

Notes
=====

Without Boundmethod
-------------------
  LOAD FAST self
  LOAD METHOD getrandbits
  LOAD FAST k
  CALL_METHOD 1

Form Boundmethod
----------------
   LOAD FAST self
   LOAD ATTR getrandbits
   STORE FAST getrandbits

Call Boundmethod
----------------
   LOAD FAST getrandbits
   LOAD FAST k
   CALL FUNCTION 1

Expected Call Frequency
-----------------------

n = 1000
r = 0 .. 1024
P(r > n) 24 / 1024 = 2.3%
E[calls] = 1 / (1 - 24/1024) = 1.024

n = 1024
r = 0 .. 2048
P(r > n) = 1024 / 2048 = 50%
E[calls] = 1 / (1 - 1024/2048) = 2.0

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45976>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to