Ted Leung on the air : On dynamic language performance

Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
2006年9月14日
On dynamic language performance

In the comments to my post about IronPython and JRuby there were some comments about C libraries for Python or Ruby which would be unusable in in a CLR or JVM based implementation. This is correct, of course, and it is a problem for people trying to port software across implementations.

Earlier this week, Joel Spolsky made some comments about Ruby performance which triggered a bunch of posts, including a lesson from Avi on the 20 year old technique of in-line method caching. David Heinemeier Hansson weighed in with a post titled "Outsourcing the performance-intensive functions", where he argues that one of the benefits of scripting languages is that you can "cheat" by calling functions written in some other language.

Of course, that capability isn't limited to scripting languages. Other languages like Smalltalk, Lisp, Dylan, and others have foreign functions interfaces that let them talk to C code, and SWIG, which is a favorite tool for making it easy to link bind C libraries to scripting languages, also works for those languages. Reusing existing C code is a fine and worthwhile thing to do.

I don't agree, however, that users of dynamic languages should just agree to outsource high performance functions to C. The whole point of using a dynamic language is developer productivity, and that should be the case for performance critical code as well. And it's not like this is an impossible task either. There are implementations of dynamic languages which are very efficient, and applying those techniques to "scripting languages" is worthwhile endeavor, which is being pursued by folks like the PyPy team. As Avi also points out, the StrongTalk VM has now been open sourced, which may make it easier for language implementors to adopt some of the rich body of work that has been done on dynamic language performance.

Will there be cases where even the most advanced implementation techniques won't yield enough performance? Sure. That's why C compilers have a feature called in-line assembly code. But you rarely see it used. Having to rewrite my performance critical dynamic language code in C should be a rarity. The better the VM's get, the more rare those occasions will be, and that's a good thing. Let's not throw up our hands and say "yeah, you're right, we're slow, but it doesn't matter because we can cheat".

[00:35] | [computers/programming] | # | TB | F | G | 3 Comments | Other blogs commenting on this post
In his article Joel looks at the performance of Ruby, and surmises that all dynamic languages must be that slow.

As shown by the language shootout he refers to, Python is still much faster than Ruby.

It would be interesting to see (although unlikely to ever happen), how fast his CPU intensive code could run as pure Python code.
Posted by
Fuzzyman at Fri Sep 15 05:12:31 2006

Strongtalk has gone fully Open Source!
Posted by
Sven Meyer at Tue Sep 19 03:53:51 2006

The whole point of using a dynamic language is developer productivity...
Yup. It always seems strange to me when people argue that language X isn't "slow" and in the next breath say "we can rewrite part of the code in C", apparently without noticing that we're now having to deal with a low level language and we presumably wanted to avoid doing that.

LuaJIT is a nice demonstration that we might be able to do better.
Posted by Isaac Gouy at Fri Oct 6 13:37:38 2006

You can subscribe to an RSS feed of the comments for this blog: RSS Feed for comments

Add a comment here:

You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are: <a href>, <em>, <i>, <b>, <blockquote>, <br/>, <p>, <code>, <pre>, <cite>, <sub> and <sup>.

You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk

Name:


E-mail:


URL:


Comment:


Remember my info?


twl JPG

About

Ted Leung FOAF Explorer

I work at the Open Source Applications Foundation (OSAF).
The opinions expressed here are entirely my own, not those of my employer.

Creative Commons License
This work is licensed under a Creative Commons License.

Now available!
Professional XML Development with Apache Tools : Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Technorati Profile
PGP Key Fingerprint
My del.icio.us Bookmarks
My Flickr Photos


Syndicate
RSS 2.0 xml GIF
Comments (RSS 2.0) xml GIF
Atom 0.3 feed
Feedburner'ed RSS feed

< September 2006 >
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Archives
2006
2005
2004
2003

Articles
Macintosh Tips and Tricks

Search
Blogs nearby
geourl PNG

Categories
/ (1567)
books/ (33)
computers/ (62)
hardware/ (15)
internet/ (58)
mail/ (11)
microcontent/ (58)
weblogs/ (174)
pyblosxom/ (36)
www/ (25)
open_source/ (145)
asf/ (53)
osaf/ (32)
chandler/ (35)
cosmo/ (1)
operating_systems/ (16)
linux/ (9)
debian/ (15)
ubuntu/ (2)
macosx/ (101)
tips/ (25)
windows_xp/ (4)
programming/ (156)
clr/ (1)
dotnet/ (13)
java/ (71)
eclipse/ (22)
lisp/ (34)
python/ (86)
smalltalk/ (4)
xml/ (18)
research/ (1)
security/ (4)
wireless/ (1)
culture/ (10)
film/ (8)
music/ (6)
education/ (13)
family/ (17)
gadgets/ (24)
misc/ (47)
people/ (18)
photography/ (25)
pictures/ (12)
places/ (3)
us/ (0)
wa/ (2)
bainbridge_island/ (17)
seattle/ (13)
skating/ (6)
society/ (20)



[Valid RSS]

del.icio.us linkblog

www.flickr.com

Blogroll

java.blogs
Listed on BlogShares


Where are visitors to this page?


pyblosxom GIF

AltStyle によって変換されたページ (->オリジナル) /