Why Python Ruby JS are slow – Alex Gaynor

Python Ruby JS are slow

Alex Gaynor

Myths on Why Languages Are slow

  • dynamic typing
    • names are bound and change at runtime
    • adaptive compilation
    • observing types
    • method jits
    • predictive type inference
      • brian hacket
      • can’t type inference JS
  • Monkey patch availibility

Rather, Idioms of the Language determine speed

Python’s slowness:

  • hash table
    • pythoners think dictionaries are lightweight
  • object == hash table
    • too simplistic idea
    • different at a fundamental level
    • fixed set of keys, versus: mapping arbitrary set of keys to arbitrary set of values

C is fast because:

  • Bring your own buffer philosophy

Slow bits

  • allocation
  • copying
  • hash table lookups

Not Slow Bits

  • attribute accesses
  • method calls, sends
  • global, constant lookups
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s