Jeremie Pelletier wrote:
language_fan wrote:
Wed, 23 Sep 2009 10:43:53 -0400, Jeremie Pelletier thusly wrote:
You're right about concurrency being a different concept than threading,
but I wouldn't give threading away for a pure concurrent model either.
I believe D is aiming at giving programmers a choice of the tools they
wish to use. I could see uses of both a concurrent model with message
passing and a threading model with shared data used at once in a
program.
The danger in too large a flexibility is that concurrency is not easy
and it is getting incresingly complex. You need to be extraordinary
good at manually managing all concurrent use of data. If I may predict
something that is going to happen, it is that there will be high level
models that avoid many low level pitfalls. These models will not
provide 100% efficiency, but they are getting faster and faster,
without compromizing the safety aspect. This already happened with
memory allocation (manual vs garbage collection - in common
applications, but not in special cases). Before that we gave some of
the error detection capabilities to the compiler (e.g. we do not write
array bounds checks ourselves anymore). And optimizations (e.g.
register allocation). You may disagree, but I find it much more
pleasant to find that the application does never crash even though it
works 15% slower than an optimal C++ code would.
15% slower is an extreme performance hit. I agree that code safety is
useful and I use this model all the time for initialization and other
code which isn't real time, but 15% takes away a lot of the
application's responsiveness, if you have 50 such applications running
on your system you just spent $1000 more in hardware to get the
performance of entry level hardware with faster code.
What are most applications these days? MS Office, a web browser, maybe
an email client, some odds and ends, and a whole bunch of web sites
running on servers somewhere (with associated database servers and some
other odds and ends).
How much does it cost to get a slightly better machine? Fully hosted?
Maybe $100/month.
How much does it cost to develop it in a faster but more error-prone
language? Maybe months more time to market, time you're not making money
but are still paying developers. Those developers will need to be more
skilled than the ones using a safer language, and thus will cost you
more. New features will take more time to develop.
It's a competitive advantage to use a slower, safer language on the web.
Desktop applications are not quite so straightforward.
If you wrote a real time renderer for example with that 15% hit, you get
a very noticeable difference in framerate. Not to mention standard GUIs
to be laggy on slower machines (just MSN messenger runs to a crawl on my
old computer, yet it can run the first UT which does way more operations
per second, because there's no performance hit by safer code bloat).
Games are not interesting in this regard. They require performance, and
they're hideously expensive. A studio can throw developers at the
problems and make them go away.
Not all games are like this, of course. But most are.