Javascript as a "serious" development language?
category: general [glöplog]
Just wondering out loud a bit here, after seeing palm's new pre phone. It looks really interesting as a phone, so I looked into the sdk a little, and it seems that the development is all done in javascript / html.
Now, that sounds utterly shit at first.. html + javascript for complex apps, running on a slow mobile phone processor? urgh. But it seems to work well, people working with it seem to think it's good, and they're providing APIs to access phone hardware and services, so presumably it'll handle accelerated drawing, opengl perhaps, and other stuff.
So how would javascript work out for something like this? Without the horrible browser drawing methods holding it back, would javascript actually be a pretty good and fast choice for mobile apps?
Now, that sounds utterly shit at first.. html + javascript for complex apps, running on a slow mobile phone processor? urgh. But it seems to work well, people working with it seem to think it's good, and they're providing APIs to access phone hardware and services, so presumably it'll handle accelerated drawing, opengl perhaps, and other stuff.
So how would javascript work out for something like this? Without the horrible browser drawing methods holding it back, would javascript actually be a pretty good and fast choice for mobile apps?
I like the simplicity.
Yeah, it's not to bad.
Well, I've basically been doing that for 3+ years now. So yes, it works. It works even better when this an actual design choice of the device manufacter and there's well thought APIs for device integration. JavaScript itself ain't slow. The bottle neck is usually the rendering and DOM manipulations, and network on devices.
make a demo with it :-)
JavaScript actually made a nice comeback with AJAX/Web2.0, considering the limited usefulness ten or so years ago (basically input validation and "DHTML"). But dev-tools seem still to be a little sketchy or so I've heard.
thanks for the answers :)
So would javascript be anywhere near the speed of equivalent c++ or whatever if it was accessing the same APIs? (assuming the platform is well optimised for it, and you're doing some "average code" rather than some special case, which somebody is sure to point out here ;)
So would javascript be anywhere near the speed of equivalent c++ or whatever if it was accessing the same APIs? (assuming the platform is well optimised for it, and you're doing some "average code" rather than some special case, which somebody is sure to point out here ;)
Naa, it's still significantly behind the speed of equivalent c++ but it's fast enough. More and more JavaScript engines developers are moving towards doing JIT and native code generation, both for desktop and device usage.
I definitely agree with p01 on that one : rendering and DOM manipulations are most likely to kill you. Now, it also depends on the browser you're running it on. With some really big differences in some cases.
Some months ago, I was working on an Intellivision emulator written in 100% javascript and using DIVs and SPANs for rendering (i.e. no canvas) :
http://knox.ac.free.fr/jsInty/
(hit Run to give it a try)
For what it's worth, here's a quick and dirty benchmark on different browsers :
IE7 : 18 fps, d'oh...
FireFox 3 : 57 fps, eh?
Google Chrome : 78 fps, woohoo!
Some months ago, I was working on an Intellivision emulator written in 100% javascript and using DIVs and SPANs for rendering (i.e. no canvas) :
http://knox.ac.free.fr/jsInty/
(hit Run to give it a try)
For what it's worth, here's a quick and dirty benchmark on different browsers :
IE7 : 18 fps, d'oh...
FireFox 3 : 57 fps, eh?
Google Chrome : 78 fps, woohoo!
On Opera I get 90'ish fps.
True. Opera is pretty fast as well. On the title screen, I go up to about 135 fps with Chrome and 125 fps with Opera.
With FF 3 I get 98-100 FPS.
firefox 3.1 beta2 - 170fps \o/
oh, but it crashes on reset ;)
IE7: 55
Opera 9.62: 173
Opera 10alpha: 173 Portable version from Opera@USB site
FF3(Feb 09): 147
Chrome: 281 (Latest SRWare Iron - http://www.srware.net/en/software_srware_iron.php)
Opera 9.62: 173
Opera 10alpha: 173 Portable version from Opera@USB site
FF3(Feb 09): 147
Chrome: 281 (Latest SRWare Iron - http://www.srware.net/en/software_srware_iron.php)
Quote:
Opera 10alpha: 173 Portable version from Opera@USB site
btw, it looks like Opera 10 will get a new JavaScript engine which is not yet in the current public alpha version.
Details (including some background tech infos) here: http://my.opera.com/core/blog/2009/02/04/carakan
javascript is the new basic
affirmative!
From what i read the other day Carakan will prolly not debut until Opera 11, maybe it'll sneak into 10.5 though. But Carakan is incredibly fast for sure, much faster than anything else available or in development atm.
Is is me or that benchmark game just plain awesome?
I wouldn't even be surprised if we'll all be using a JavaScript OS 5-10 years from now. (I wish that would be a joke, but it probably isn't).
Technically speaking, I'd rather like to see .NET or JVM succeed since JS is/was meant only for "additional" glue code, validating forms etc. JS is not type-safe, static code analysis is kind of hard with dynamic typing..I wouldn't wanna code anything larger than a few thousand lines of codes in that kind of language.
IMHO, this whole DHTML/JavaScript craze is totally insane and a waste of energy/resources. At least the heavy lifting should be left to "real" languages (like good ole C/C++..)
Maybe there should be a MIPS/ARM like VM in every OS (or browser) that translates the opcodes to the actual native opcodes. You could still build a JS frontend for that, or a C frontend if you wanted to. Why focus only on JS ? With the proper browser plugins you could easily achieve a performance similar to classic native code compilers (or even better, because the VM could analyze/optimize the code at runtime).
Technically speaking, I'd rather like to see .NET or JVM succeed since JS is/was meant only for "additional" glue code, validating forms etc. JS is not type-safe, static code analysis is kind of hard with dynamic typing..I wouldn't wanna code anything larger than a few thousand lines of codes in that kind of language.
IMHO, this whole DHTML/JavaScript craze is totally insane and a waste of energy/resources. At least the heavy lifting should be left to "real" languages (like good ole C/C++..)
Maybe there should be a MIPS/ARM like VM in every OS (or browser) that translates the opcodes to the actual native opcodes. You could still build a JS frontend for that, or a C frontend if you wanted to. Why focus only on JS ? With the proper browser plugins you could easily achieve a performance similar to classic native code compilers (or even better, because the VM could analyze/optimize the code at runtime).
what p01 said, and what p01 said.
flash actionscript is actually ecmascript, and it's pretty fast, because it uses flash player api instead of rendering stuff possible with js, also, it uses jit compiler (which was made opensource and released by adobe to the tamarin project). so the language itself is not bad at all. if js is used properly as a native development platform for some device like cell phone, i guess it's good enough to do some impressive stuff with it. just take a look at webapps for iphone.
flash actionscript is actually ecmascript, and it's pretty fast, because it uses flash player api instead of rendering stuff possible with js, also, it uses jit compiler (which was made opensource and released by adobe to the tamarin project). so the language itself is not bad at all. if js is used properly as a native development platform for some device like cell phone, i guess it's good enough to do some impressive stuff with it. just take a look at webapps for iphone.
JS isn't too bad. But it has a few problems:
- many people think it's a normal OO language and try to use it as that, while it really is a Prototype-based language
- It has some really bad design decisions, so much that I consider it broken by design, for example
BTW: most of the time you want to use ===, this variant doesn't try to convert types (0 === 0 true, but 0 === "0" is false)
Oh, and always use "var", never omit it or you will have nasty side effects
- many people think it's a normal OO language and try to use it as that, while it really is a Prototype-based language
- It has some really bad design decisions, so much that I consider it broken by design, for example
Code:
0 == 0 is true
0 == "0" is true
0 == "" is true
1 == [1] is true
0 == [0] is true
0 == [] is true, but
[] == [] is false
[0] == [0] is false
BTW: most of the time you want to use ===, this variant doesn't try to convert types (0 === 0 true, but 0 === "0" is false)
Oh, and always use "var", never omit it or you will have nasty side effects
Yes One time i Make javascrip in my browser it goe Like OK YOU HAVE NO JAVASCRIPT INSTALL Please continue ok??
Make Fuck To You M*****!!! !
Make Fuck To You M*****!!! !
knox: nice little emulator there :D Got 208fps in safari 4 beta, on 2,8ghz core2.
Seems javascript could be good for mobile use after all then, as it presumably won't be bogged down by the rendering stuff if they've designed it well. Interesting, I hope palm gets some success with it, I always liked their stuff in the past but they really fucked up with their OS for the last few years. I'll write some stuff for it if they do well.
Seems javascript could be good for mobile use after all then, as it presumably won't be bogged down by the rendering stuff if they've designed it well. Interesting, I hope palm gets some success with it, I always liked their stuff in the past but they really fucked up with their OS for the last few years. I'll write some stuff for it if they do well.