OT: Adding D Editor Support

Georg Wrede georg at nospam.org
Fri Jun 20 02:02:47 PDT 2008


Georg Wrede wrote:
> Nick Sabalausky wrote:
> 
>> "Mike Parker" <aldacron at gmail.com> wrote in message 
>> news:g34k0q$1uns$1 at digitalmars.com...
>>
>>> Chris R. Miller wrote:
>>>
>>>
>>>> If you use D for the browser based stuff, you'll have the great 
>>>> advantage of not needing to sink all the extra money into a server 
>>>> with extra RAM to support J2EE, which can consume a frightful amount 
>>>> of memory!
>>>
>>>
>>> Actually, when people use the term 'browser-based games' they are 
>>> usually referring to Flash, Silverlight, Java Applets, or some sort 
>>> of custom browser plugin (i.e. games that run within the browser). 
>>> I'm thinking that's what John is referring to. D provides no benefit 
>>> there.
>>>
>>> What you are talking about are generally referred to as 'web-based 
>>> games' (i.e. games played via HTTP requests and/or browser 
>>> scripting). And really, with Java you don't need a J2EE stack for 
>>> that. A low-overhead app server like Jetty coupled with Servlets and 
>>> JSP pages will do nicely. I'd prefer that to a PHP solution. D would 
>>> work just as well in that environment, but my gut tells me there'd be 
>>> little difference in memory overhead.
>>
>>
>>
>> If there's anything like leaderboards or multiplayer, then that would 
>> require a backend, and that backend could be written in D.
>>
>> I would *love* for D to be a viable language for the front-end though. 
>> I truly despise Flash (including the official IDE), but I'm working on 
>> a project right now for which Flash is, unfortunately, the best 
>> option. [side rant] And the client (people, not browser) are on shared 
>> hosting so it's gotta use PHP for the backend, and I hate that every 
>> bit as much. [end side rant]. I truly wish I could just do the whole 
>> damn thing in D.
>>
>> Which does bring me to one of the few things I *do* think VMs are good 
>> for: Embedded webpage applets should be in a sandbox. That's why I 
>> would actually like to see D support compiling to the JVM (*in 
>> addition* to native code, of course). Because that way I could use D 
>> as a replacement for Flash.
>>
>> Come to think of it, doesn't the newest version of Flash support using 
>> C++ as an alternative to ECMAScript? I thought I heard that somewhere. 
>> If it does, maybe that opens the door for Flash-using-D? Anyone know? 
>> But then again anything beyond Flash 7 is poorly supported on embedded 
>> systems and as I understand it (which is to say: not very well) 
>> Adobe's newer "Flash Lite" strategy seems like more work for embedded 
>> browser developers than the old Flash SDK. But I'm probably wrong on 
>> that. Actually that reminds me, I have no idea how the Java Applet 
>> support is on embedded browsers. Might not be great either. Dang.
>>
>> And heck, as long as I'm in pipe-dream land, along with "using D for 
>> stuff embedded in webpages", some D-to-PHP and D-to-ASP converters 
>> would be nice. That'd let me use D for back-end even when I have no 
>> control over the server. 'Course, you'd be giving up anything nice 
>> about being natively-compiled, but at least I wouldn't have to use 
>> ASP/PHP/some-other-dynamically-typed-flavor-of-the-month (all I really 
>> mean by that last one is that to a non-fan of such languages like me, 
>> it seems like popular dynamically typed languages keep popping up all 
>> over the place).
>>
>> Sorry for rambling and ranting so far offtopic. 
> 
> 
> (More off-topic rambling below.)
> 
> The other week I actually bought a new computer (2.4GHz 4-CPU, 4GB, 
> etc.) simply because I got an assignment for a client that my current 
> computers couldn't handle. (For the record, I've moved to this Century!)
> 
> Now, running Linux, I had the performance meter running on one of the 
> desktops, and I was reading TV programs in a browser, D documentation on 
> another, and E-mail in another. Then there was the desktop where I'd 
> gathered all the windows I needed to study and try Lua.
> 
> All of a sudden I heard the CPU fan revving up. I wondered what could be 
> the reason for it since I hadn't done anything exceptional for half an 
> hour. Turns out there's a banner ad on the TV programming page that 
> flashes pictures as fast as it can, with no pauses.

Merely changing the applet to flip the pictures ten times a second would 
drop the CPU usage to almost undetectable levels. And the banner would 
still look the same.

> Until that 
> particular commercial got on (because of an automatic background reload 
> of the TV programming page) the CPU load was at 0.1 0.01 0.0 0.02. When 
> it got started the load went to 0.1 0.3 0.0 0.02.

Sloppy writing. The above is actually not the output of /uptime/ or 
such, I was thinking in percentages as seen from the cpu meter graph. So 
a 0.3 here means 30%. This does not change anything, it's still valid.

> In other words, one of my four CPUs was loaded to 30% simply because of 
> this stupid banner. Since the CPU fan started revving up, I understood 
> that the computer was using more power. Later I put a gadeget I have, 
> that's a meter of Electric currency consuption, and it showed almost a 
> 10% increase in power. On a 1-CPU machine the consumption should go up 
> much more than that.
> 
> Think about it. If such a web site is for TV programming in America, and 
> it puts such a banner on its pages, we might have 50 million people 
> having this page visible. A 10% increase in electricity consumption 
> should mean 200W * +10% * 50M = over one megawatt. That's equal to the 
> output of one nuclear power plant.

Suppose a banner ad company which has deals with, say, half of the most 
visited pages, decides to put a particular ad on everybody's screen 
(which could happen if a major company (Coca-Cola, Apple, etc) decides 
to bring out a product with a bang), that has such a badly designed 
Flash banner, the electric company really should see a stunning 
difference in electricity consumption.

> So, don't believe this. I didn't. But I've done the math several times 
> over, and I can't help getting to this answer.
> 
> Greenpeace sure ought to go shoot the guy.

They should. It's really a frivolous use of other peoples' computing 
power and energy.




More information about the Digitalmars-d mailing list