Decline and fall of scripting languages ?

P

Paul Rubin

Donn Cave said:
On the contrary, there are a couple. Ghc is probably the leading
implementation these days, and by any reasonable measure, it is serious.

OK, I've looked at the Haskell "gentle introduction" page a little bit
and it's nice. I do remember Ocaml beating Haskell on a performance
shootout and am not sure whether Ghc was used for the Haskell entry.

I notice that Haskell strings are character lists, i.e. at least
conceptually, "hello" takes the equivalent of five cons cells. Do
real implementations (i.e. GHC) actually work like that? If so, that's
enough to kill the whole thing right there.
Objective CAML is indeed not a pure functional language.

Should that bother me? I should say, my interest in Ocaml or Haskell
is not just to try out something new, but also as a step up from both
Python and C/C++ for writing practical code. That is, I'm looking for
something with good abstraction (unlike Java) and type safety (unlike
C/C++), but for the goal of writing high performance code (like
C/C++). I'm even (gasp) thinking of checking out Ada.
 
M

Michael Hudson

Donn Cave said:
On the contrary, there are a couple. Ghc is probably the
leading implementation these days, and by any reasonable
measure, it is serious.

Objective CAML is indeed not a pure functional language.

*cough* unsafePerformIO *cough*

Cheers,
mwh
 
D

Donn Cave

Paul Rubin said:
I notice that Haskell strings are character lists, i.e. at least
conceptually, "hello" takes the equivalent of five cons cells. Do
real implementations (i.e. GHC) actually work like that? If so, that's
enough to kill the whole thing right there.

Yep. There is a separate packed string type.
Should that bother me? I should say, my interest in Ocaml or Haskell
is not just to try out something new, but also as a step up from both
Python and C/C++ for writing practical code. That is, I'm looking for
something with good abstraction (unlike Java) and type safety (unlike
C/C++), but for the goal of writing high performance code (like
C/C++). I'm even (gasp) thinking of checking out Ada.

It's up to you, I'm just saying. Speaking of C++, would
you start someone with Python or Java for their first OOPL?
Kind of the same idea.

Donn Cave, (e-mail address removed)
 
M

Mike Meyer

Well, I tried sending this via email, but I can't derive a valid
address from Paul's anti-spammed address.

My apologies to the rest of you for this.

Paul Rubin said:
Should that bother me? I should say, my interest in Ocaml or Haskell
is not just to try out something new, but also as a step up from both
Python and C/C++ for writing practical code. That is, I'm looking for
something with good abstraction (unlike Java) and type safety (unlike
C/C++), but for the goal of writing high performance code (like
C/C++). I'm even (gasp) thinking of checking out Ada.

If you're thinking about checking out Ada, you might want to take a
look at D. I haven't gotten very far into it myself (I was attracted
by DbC), but it looks like a modern redesign of C: GC, OO, and
typedefs that actually define new types, while still being something
it's possible to generate reasonably fast code for.

<mike
 
P

Paul Rubin

Mike Meyer said:
Well, I tried sending this via email, but I can't derive a valid
address from Paul's anti-spammed address.

Yeah, I should update that url since they turned off the forwarding.
It should be <http://paulrubin.com>. But a thread titled "decline and
fall of scripting languages" is reasonably on-topic for clpy, and
discussion of non-Python languages is reasonable for a thread with
such a title. So replying to the newsgroup is appropriate.
If you're thinking about checking out Ada, you might want to take a
look at D. I haven't gotten very far into it myself (I was attracted
by DbC), but it looks like a modern redesign of C: GC, OO, and
typedefs that actually define new types, while still being something
it's possible to generate reasonably fast code for.

Yeah, I've looked at D and it seems pretty nicely designed, much more
tasteful than C++. So far though, it seems to have only one
implementation and not much of a user base. I dunno that I'm really
that interested in checking out Ada. It seems like a dead end. Its
main virtue is that it can target small embedded processors, which I
don't know if D can do all that easily.

Right now I'm mainly interested in OCaml, Haskell, Erlang, and maybe
Occam. Haskell seems to have the happiest users, which is always a
good thing. Erlang has been used for real-world systems and has
built-in concurrency support. OCaml seems to crush Haskell and Erlang
(and even Java) in performance. Occam isn't used for much practical
any more, but takes a purist approach to concurrency that seems worth
studying.

The idea is to use one of those languages for a personal project after
my current work project wraps up pretty soon. This would be both a
learning effort and an attempt to write something useful. I'm
thinking of a web application like a discussion board or wiki,
intended to outperform the existing ones, i.e. able to handle a
Slashdot or Wikipedia sized load (millions of hits/day) on a single
fast PC instead of a rack full. "Single fast PC" will probably soon
come to mean a two-cpu-chip motherboard in a 1U rack box, where each
cpu chip is a dual core P4 or Athlon, so the application should be
able to take advantage of at least 4-way multiprocessing, thus the
interest in concurrency.
 
D

Donn Cave

Quoth Paul Rubin <http://[email protected]>:

| Right now I'm mainly interested in OCaml, Haskell, Erlang, and maybe
| Occam. Haskell seems to have the happiest users, which is always a
| good thing. Erlang has been used for real-world systems and has
| built-in concurrency support. OCaml seems to crush Haskell and Erlang
| (and even Java) in performance.

I'm sure you're aware that these are all arguable. In particular,
shootout figures aren't a really reliable way to find out about
performance.

| The idea is to use one of those languages for a personal project after
| my current work project wraps up pretty soon. This would be both a
| learning effort and an attempt to write something useful. I'm
| thinking of a web application like a discussion board or wiki,
| intended to outperform the existing ones, i.e. able to handle a
| Slashdot or Wikipedia sized load (millions of hits/day) on a single
| fast PC instead of a rack full. "Single fast PC" will probably soon
| come to mean a two-cpu-chip motherboard in a 1U rack box, where each
| cpu chip is a dual core P4 or Athlon, so the application should be
| able to take advantage of at least 4-way multiprocessing, thus the
| interest in concurrency.

Oh. Note that the FP world has been historically attracted to the
"green" thread model, where threads are implemented in the runtime
like (old) Stackless micro-threads, much faster and more tractable
for runtime data structures ... but runs on only one CPU at a time.
Ocaml & I believe current ghc support native OS threads, Erlang I
would guess not but wouldn't know for sure. Don't know about ghc
internals, the way I remember it ocaml's native thread system has
something like Python's global lock, instead of locks around each
memory management function etc.

Donn Cave, (e-mail address removed)
 
B

Bengt Richter

On 08 Aug 2005 20:37:01 -0700 said:
Right now I'm mainly interested in OCaml, Haskell, Erlang, and maybe
Occam. Haskell seems to have the happiest users, which is always a
good thing. Erlang has been used for real-world systems and has
built-in concurrency support. OCaml seems to crush Haskell and Erlang
(and even Java) in performance. Occam isn't used for much practical
any more, but takes a purist approach to concurrency that seems worth
studying.
IIRC, I've seen something about a web server implemented in erlang
with tremendous performance at high levels of concurrency where other
implementations bog down. So I would want further details before I
believe that all OCaml versions "crush" all Erlang versions in performance.

The idea is to use one of those languages for a personal project after
my current work project wraps up pretty soon. This would be both a
learning effort and an attempt to write something useful. I'm
thinking of a web application like a discussion board or wiki,
intended to outperform the existing ones, i.e. able to handle a
Slashdot or Wikipedia sized load (millions of hits/day) on a single
fast PC instead of a rack full. "Single fast PC" will probably soon
come to mean a two-cpu-chip motherboard in a 1U rack box, where each
cpu chip is a dual core P4 or Athlon, so the application should be
able to take advantage of at least 4-way multiprocessing, thus the
interest in concurrency.
I'd suggest finding that Erlang web server writeup.

Hm, some googling ...
I think this is the graph I saw:

http://www.sics.se/~joe/apachevsyaws.html

Can't vouch for what it means, but taken at face value
would seem to warrant a further look into details.

This turned up also

http://eddie.sourceforge.net/txt/WP_1.0.html

which I hadn't seen before, and which looks interesting
though maybe stale?


I guess this is a home for erlang:
http://www.erlang.se/

Much other stuff, but you know how to google ;-)

Regards,
Bengt Richter
 
D

Donn Cave

Michael Hudson said:
*cough* unsafePerformIO *cough*

(Hope that cough isn't anything serious.) The way I
understand it, you'd be a fool to use unsafePerformIO
in a way that would generally compromise functional
purity. It really is "unsafe", inasmuch as it violates
central assumptions of the language evaluation model.

Some people take "pure" too seriously. In this context,
functional purity just means that we know that in principle,
the value of an expression is constant - given the same
inputs to a function, we always expect the same result.
It doesn't mean "free from blemish." unsafePerformIO is
a sort of blemish, I suppose, but it's a pure functional
language in my book.

Donn Cave, (e-mail address removed)
 
P

Paul Rubin

IIRC, I've seen something about a web server implemented in erlang
with tremendous performance at high levels of concurrency where other
implementations bog down. So I would want further details before I
believe that all OCaml versions "crush" all Erlang versions in performance.

Good point you and Donn make about shootouts. However, the shootout
figure differences in these particular cases are vast, and nature of
the implementations seems to make that result inevitable. I've been
looking a little more at the docs of the languages (haven't written
any code yet). Erlang is sort of like Python: dynamically typed, and
compiled to bytecode that gets interpreted. Haskell is statically
typed and has apparently has a real compiler, but uses lazy evaluation
for everything, which if done in the obvious way (I don't know how
they actually do it), there's a closure wrapped around every value.
Also, the language itself seems to do a lot of stuff for you behind
the scenes, almost like Prolog. In that sense it's really a higher
level language than normal imperative languages, so I can see why
people like programming in it. But it doesn't make for the fastest
machine code. OCaml seems to be sort of like Lisp with static types,
and syntax geared towards functional-style programming. In that sense
it's maybe less high-level than Haskell. But it means standard Lisp
compiler techniques can make excellent output code, seriously
competing with C/C++ compilers. There's an SML compiler (MLton) that
seems to significantly beat C++ for scientific number crunching speed
a lot of the time.
I'd suggest finding that Erlang web server writeup.
Hm, some googling ...
I think this is the graph I saw:
http://www.sics.se/~joe/apachevsyaws.html

Can't vouch for what it means, but taken at face value
would seem to warrant a further look into details.

That looks like purely a test of how many simultaneous connections the
server can handle. They had each client connect to the server, read
one byte, then hold the connection open and do nothing. Apache uses a
separate process or OS thread for each connection, so it wedged once a
few thousand requests were open. Erlang apparently uses microthreads,
probably allocating every call frame on the heap like SML/NJ did, so
they showed it with 80,000 connections open. The key, though, is that
the clients were doing basically nothing. It just meant that many
small data structures were allocated in memory of one server process.
It doesn't say anything about how fast the server can actually
generate and serve dynamic content.

The Mnesia database looks interesting and I'm going to have to read
about it further and figure out if something like it can be done in
Python.

I realized that my server will spend a lot of cycles in mod_gzip or
the equivalent. So I think a (maybe not achievable) performance goal
is for the web app to use 50% of the available cycles making html, and
the other 50% go to gzipping the html. That means that the app should
make dynamic output as fast as gzip can compress it, which is at least
several megabytes per second. (All static content would be stored
pre-gzipped and served by khttpd (Linux kernel httpd) without the
dynamic app ever seeing the request). I think that requires compiled
code and use of an in-process database (no remote SQL) for almost all
requests. It's an order of magnitude faster than the crap that almost
everyone is running on real sites.

Oh, this is nice. I'm thinking of an architecture like OK Web Server
(http://okws.org) but without (ugh!) C++, letting the kernel httpd
serve static content as mentioned.
I guess this is a home for erlang:
http://www.erlang.se/

That's the commercial site, the free stuff is at www.erlang.org.
Much other stuff, but you know how to google ;-)

Yes, thanks ;-).
 
P

Paul Rubin

Paul Rubin said:
So I think a (maybe not achievable) performance goal
is for the web app to use 50% of the available cycles making html, and
the other 50% go to gzipping the html. That means that the app should
make dynamic output as fast as gzip can compress it,

It occurs to me that if the html pages are generated from templates
with little bits of executable code, then maybe the static parts of
the templates can be gzipped ahead of time, and a lot of the dynamic
stuff is cacheable and can be gzipped ahead of time. (gzip is sort of
a "linear operator" in that gzip(a)+gzip(b) is a valid though not
maximally efficient gzip encoding for gzip(a+b)). That could save
some cpu cycles at the expense of impaired compression ratio. Hmm.
 
C

Christos Georgiou

Erlang apparently uses microthreads,
probably allocating every call frame on the heap like SML/NJ did, so
they showed it with 80,000 connections open.

This is 80000 TCP/IP v4 connections open?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top