<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 11, 2015 at 4:50 AM, BartC <span dir="ltr"><<a href="mailto:bc@freeuk.com" target="_blank">bc@freeuk.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You just seem surprised that using eval() to do this is slower than a direct call.</blockquote></div><br>Well, it is surprising. Most uses of eval() are to evaluate Python expressions in string form. That I expect to be quite slow, given the parsing+byte compilation overhead. I wouldn't expect eval()ing a code object to be all that different than calling the function containing the code object.</div><div class="gmail_extra"><br></div><div class="gmail_extra">My guess (without looking in ceval.c) is that the code path through the VM has been tweaked heavily over the years to try and speed it up. Except for places where that path overlaps with the path for eval(code_object), I doubt any attention has been paid to speeding up eval. I could certainly be way off-base here. Perhaps the path taken through the interpreter for eval(code_object) is more-or-less a subset of the path taken for a simple function call.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Skip</div><div class="gmail_extra"><br></div></div>