Ralph Richard Cook's comment on the issue of writing highly optimized Lisp made me feel all happy and smug.
I look at it this way. A lot of the new, interesting software is being written in a combination of two languages; a high-level, dynamically typed language with good built-in data structures and an environment for rapid software development, and a statically typed, heavily optimized language for performance. For a Python programmer, these two languages are Python and C. For the Common Lisp programmer, the two languages are Common Lisp and Common Lisp.
But then Pinku Surana's take made me worry a little.
The real problem is that normal programmers can not predict the performance of programs written in high-level languages, thus only wizards can optimize them because they have an intimate understanding of the compiler and runtime. A more satisfying response to a troller's assertion that “your language is slow” is to make integration with C drop-dead easy.
It would be nice if Lisp could be integrated with C as easily as Python can (it is kind of neat seeing the progress made in OpenMCL with Objective C integration). And maybe it's true that only wizards can achieve the kind of performance in Lisp that non-magical folk can get from C. Or maybe not, maybe just a couple years spent programming in Lisp, a degree of experience you'd expect from any serious programmer, would be good enough.
Posted by jjwiseman at March 31, 2004 10:41 AMWhy does anyone need to _predict_ the performance when you can _measure_ it with a profiler?
Posted by: Paul Graham Fan on March 31, 2004 04:24 PMI think that Pinku misses a few important points. The first is this: 'almabench' was already optimized (for C++), and probably better code than most C++ programmers can manage. So good lisp hackers and good C++ hackers can produce similarly performing code for the same task. All this means is that the language is not constraining you (as some might claim).
More importantly: no kind of python coder can achieve this sort of performance (within the language), but most couldn't do it while resorting to C, either. The language constrains you, but allows an 'easy' out --- write it in another language. This does not make your python programmer an expert C progammer, magically.
Most importantly: it is far too easy to get hung up on optimization. There are only two valid reasons for worrying about this. Either the code is inherently expensive (i.e. unoptimized version will take 6 months to complete, optimized version will take a few days), or it is to be run an awflu lot of times. Neither of these scenarios is an issue for almost all programmers, almost all of the time. If a bit of code is actually important enough to worry about this, you ought to be able to find (or create) someone competent to write it.
Now the converse problem, truly *bad* performance is almost always an algorithm issue. And a powerful language like lisp does allow you more rope this way --- it is easy to do things in lisp that are almost inconcievable in 'c' (notwithstanding the 10th law). However, the fact that a lot of programmers are pretty ignorant of fundamental CS and the basic properties of there own programs is not a *language* issue.
Posted by: cymonk on March 31, 2004 05:58 PM"More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including stupidity."
W.A. Wulf
Truly this applies most to choosing the language to write a program in, judging by the programs on my computer.
Posted by: Luke Gorrie on March 31, 2004 09:11 PMOn the "it would be nice if Lisp could be integrated with C as easily as Python can" front:
Someone here at Franz is hacking the latest SWIG to add ACL generation of interfaces. So, it will be as easy as Python, if there is a SWIG definition for the library. I think the work will be done in a few weeks, and we'll make it available as soon as it is.
A nice and fast way to make Lisp as easily integrable with C/C++ as Python (or more precisely, as Pyste, http://www.boost.org/libs/python/pyste/ ) is to use gccxml ( http://www.gccxml.org/ ) to parse the C/C++ headers to an equivalent XML, and then with Lisp parse that XML (easy) using that information to generate UFFI bindings. This can be extended to C++ getting the mangled symbols with a pipe to "nm" or using the same algorithm as in gcc to get them. I think that for an experienced Lisp programmer this can be an one or two weekends project. GCCXML makes SWIG obsolete (Pyste uses GCCXML).
Kevin's comment on integration with C via SWIG is good news. The reason C integration is important is because most folks writing high-perf code will be using optimized libraries, rather than starting from scratch. Since the Lisp compilers did such a great job with C-like Lisp, perhaps someone can cook up a DSL which is a subset of Lisp suited to generating fast code. Scheme48's PreScheme is a nice start. Furthermore, one could slap some macros around this DSL to create another DSL suitable for array-processing code, similar to Sisal or ZPL. The Lisp compilers might need extensions to support SIMD instructions. Finally, one might need support for pinning large arrays in GC memory. Forgive me if all this is already provided, I'm too lazy to check the docs.
A dynamic language with very good C integration is goo. You can run the environment such that any form you type in (or load) is automatically compiled to c, then loaded as a .so. You can also embed C code inside your goo code (and can call back into goo from C).
Even if the language isn't useful for you, you can still mine its implementation docs for ideas.
(Either MT isn't letting me include hrefs or I'm doing something wrong; either way, http://www.googoogaga.org/)
4680t2411HI1512sMEDV EDVER YNICE SITE 496584680t2411
Posted by: MEDVED1007 on March 22, 2007 07:56 PM4212t4291Hi NEWS 117[url=http://www.google.com/8] GOOGLE8 [/url]4212t4291
Posted by: MEDVED2888 on March 22, 2007 07:57 PM5388t5560Hi NEWS 286[url=http://www.google.com/8] GOOGLE8 [/url]5388t5560
Posted by: MEDVED808 on March 22, 2007 07:58 PM5928t9268Jenny slowly stripped 2316down to her brief translucent pink panties, while continuing to smoothly sway her hips, and shake her boobies, to the pounding caned music, as she moved in to give the big, blond-haired guy seated before her, a lap-dance he would remember. She straddled his thighs and slipped her arms about his neck, smiling at him, as she bucked and ground her hips, careful not to brush her crotch against the bulge of his erection. She arched her back, thrusting her shapely breasts forward, knowing the guy was aching to grasp her swaying orbs, dying to envelope her nipples with his hot mouth. But the customers were not allowed to touch the girls. well not officially! He groaned with unrequited desire, and pushed a twenty-dollar bill into the waistband of her panties, with fat, trembling fingers. She was one of three similarly attired, near naked girls, who were simultaneously writhing their sweet tushes over the laps of three seated male club members, while dozens more customers looked on, eagerly awaiting their own turn, including several women. Jenny had been working at the lap-dancing club for three weeks now, and was getting pretty good at this ultimate in sexual titivation. The money was pretty good, if you included the tips and she got plenty. She rubbed the guy face between her shapely breasts, finally allowing him to kiss and suck on her erect nipples, as she arched her spine and threw her head back, gasping with genuine pleasure. Finally the pounding musical accompaniment drew to a close and the lap-dance ended. As he pushed another twenty into the top of her flimsy underwear, she asked, in a husky voice, Would you like for me to dance for you privately, sir? They both knew what this really meant. If the guy agreed, another girl would replace her, while she was away, and her cut of the extra fee, would be a cool hundred bucks. It was the part of the job that Jennifer least liked, but she had to agree to it, if she wanted to stay employed. HI NICE Day.Jenny slowly stripped 4562down to her brief translucent pink panties, while continuing to smoothly sway her hips, and shake her boobies, to the pounding caned music, as she moved in to give the big, blond-haired guy seated before her, a lap-dance he would remember. She straddled his thighs and slipped her arms about his neck, smiling at him, as she bucked and ground her hips, careful not to brush her crotch against the bulge of his erection. She arched her back, thrusting her shapely breasts forward, knowing the guy was aching to grasp her swaying orbs, dying to envelope her nipples with his hot mouth. But the customers were not allowed to touch the girls. well not officially! He groaned with unrequited desire, and pushed a twenty-dollar bill into the waistband of her panties, with fat, trembling fingers. She was one of three similarly attired, near naked girls, who were simultaneously writhing their sweet tushes over the laps of three seated male club members, while dozens more customers looked on, eagerly awaiting their own turn, including several women. Jenny had been working at the lap-dancing club for three weeks now, and was getting pretty good at this ultimate in sexual titivation. The money was pretty good, if you included the tips and she got plenty. She rubbed the guy face between her shapely breasts, finally allowing him to kiss and suck on her erect nipples, as she arched her spine and threw her head back, gasping with genuine pleasure. Finally the pounding musical accompaniment drew to a close and the lap-dance ended. As he pushed another twenty into the top of her flimsy underwear, she asked, in a husky voice, Would you like for me to dance for you privately, sir? They both knew what this really meant. If the guy agreed, another girl would replace her, while she was away, and her cut of the extra fee, would be a cool hundred bucks. It was the part of the job that Jennifer least liked, but she had to agree to it, if she wante5928t9268
Posted by: MEDVED1375 on March 22, 2007 08:00 PM