Re: Why is function call - recursive especially - in python so slow?

Discussion in 'Python' started by Terry Reedy, Oct 19, 2004.

  1. Terry Reedy

    Terry Reedy Guest

    <> wrote in message
    > I'm doing an analysis of program code performance when written in python
    > as oppose to other programming languages, and can't seem to figure out
    > why
    > is the call of functions so slow?


    Partly because function parameter definitions and function calls are so
    flexible. For instance: named parameters, default values, and *seq and
    **dic parameters.

    > Is a context being created and stored on stog each time


    I do not know whether stog is a type or new word for me. However, I
    believe that at present all function calls other than a generator.next
    call-after-first-yield do set up a new stack frame. (There has been some
    discussion of some reuse in other situations also.)

    > How EXACTLY does it work?


    The reference manual defines that sematics that any implementation must
    implement. 'Exactly' how any particular implemention fulfills that
    contract is in the sources.

    Terry J. Reedy
    Terry Reedy, Oct 19, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mike
    Replies:
    3
    Views:
    375
    Virgil Green
    Jul 11, 2005
  2. Replies:
    1
    Views:
    471
    Alex Martelli
    Oct 18, 2004
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,739
    Smokey Grindel
    Dec 2, 2006
  4. n00m
    Replies:
    12
    Views:
    1,098
  5. Alok
    Replies:
    3
    Views:
    237
Loading...

Share This Page