• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Rdio's Alex Gaynor at Heroku's Waza 2013: Why Python, Ruby and Javascript are Slow
 

Rdio's Alex Gaynor at Heroku's Waza 2013: Why Python, Ruby and Javascript are Slow

on

  • 1,178 views

Rdio Software Engineer Alex Gaynor (@alex_gaynor) took to the #Waza 2013 stage (Heroku's Developer Conference) to talk about "Why Python, Ruby and Javascript are Slow". Gaynor argues that developers ...

Rdio Software Engineer Alex Gaynor (@alex_gaynor) took to the #Waza 2013 stage (Heroku's Developer Conference) to talk about "Why Python, Ruby and Javascript are Slow". Gaynor argues that developers should aim to make performance beautiful. For more from Gaynor or to contact him, ping him at @Alex_Gaynor.

For more on Waza visit http://waza.heroku.com/2013.

For Waza videos stay tuned at http://blog.heroku.com or visit http://vimeo.com/herokuwaza

Statistics

Views

Total Views
1,178
Views on SlideShare
1,178
Embed Views
0

Actions

Likes
4
Downloads
14
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Rdio's Alex Gaynor at Heroku's Waza 2013: Why Python, Ruby and Javascript are Slow Rdio's Alex Gaynor at Heroku's Waza 2013: Why Python, Ruby and Javascript are Slow Presentation Transcript

    • Why Python, Ruby, and Javascript are slow Alex Gaynor Waza 2013
    • You may know me from...
    • rdio.com
    • • CPython• Django• PyPy
    • Twitter rants abouthow computers are bad
    • Topaztopazruby.com
    • There is no benchmark but your benchmark
    • Lame Excuses about why they’re Slow
    • Dynamic Typing
    • “You can monkey patch anything”
    • Harder to Optimize vs. Slow
    • The Truth
    • Let’s talk about C
    • struct Point { double x; double y; double z;};
    • class Point(object): def __init__(self, x, y, z): self.x = x self.y = y self.z = z
    • data = { "x" x, "y": y, "z": z,}
    • Dictionary vs. Object
    • std::hash_set<std::string, double> point;point["x"] = x;point["y"] = y;point["z"] = z;
    • And it would be slow
    • Why don’t people care?
    • Let’s talk about strings
    • Given a string matching: “w+-d+”return the integral part of the value
    • int(s.split("-", 1)[1])
    • atoi(strchr(s, -) + 1)
    • Things that take time• Hash table lookups• Allocations• Copying
    • The C way: BYOB
    • char *data = malloc(1024);while (true) { read(fd, data, 1024); char *start = data; while (start < data + 1024) { if (isspace(*start)) { break; } start++; } printf("%sn", start);}
    • while True: data = os.read(fd, 1024) print data.lstrip()
    • long *squares(long n) { long *sq = malloc(sizeof(long) * n); for (long i = 0; i < n; i++) { sq[i] = i * i; } return sq;}
    • def squares(n): sq = [] for i in xrange(n): sq.append(i * i) return sq
    • Missing APIs
    • from __pypy__ import newlist_hintdef squares(n): sq = newlist_hint(n) for i in xrange(n): sq.append(i * i) return sq
    • Don’t make us add heuristics
    • Heuristics = WAG
    • Growing dividebetween optimizing and not
    • Recap• Line for line these languages are fast!• Take care in data structures (data structure heuristics are the WORST)• We need better no-copy/preallocate APIs
    • Don’t abandon beauty,simplicity, our values for performance Make performance beautiful.
    • Thank you!https://speakerdeck.com/alex @alex_gaynor
    • If there’s time• Java collections vs. Array and Hash. Need more choices.• Stop writing C extensions, use something like cffi• Teach good benchmarking practices