Processing Visualization Language Ported To Javascript 171
Manfre writes "On his birthday, John Resig (creator of jQuery) has given a present to developers by releasing Processing.js. This is a Javascript port of the Processing Visualization Language and a first step towards Javascript being a rival to Flash for online graphics content. His blog post contains an excellent writeup with many demos."
Heh AvP comes ot mind here (Score:5, Funny)
Re:Heh AvP comes ot mind here (Score:4, Insightful)
Re:Heh AvP comes ot mind here (Score:5, Funny)
Re: (Score:3, Interesting)
Re:Heh AvP comes ot mind here (Score:4, Funny)
4F682079657320776520646F2E
Re: (Score:3, Funny)
Re: (Score:2, Funny)
The don't speak for me either. I'm really getting into this UTF-8 stuff lately.
Re: (Score:3, Insightful)
And, BTW, we need one badly, because the Flash (I don't trust Adobe) and Silverlight (I don't trust MS) crowds are coming and won't wait for a fast JavaScript engine.
'polished turd' (Score:3, Insightful)
but this is like a polished-turd. Flash doesn't exist anymore to do animation or dynamic graphics, it exists to run fast. JS engines were not designed to process this kind of data efficiently, as seen by your CPU graph when running the demos.
I don't want to take away from the work, because it's a slick hack, but it's not the right tool for this job.
Regards,
Re:'polished turd' (Score:5, Insightful)
Wait, are we talking about the same Flash? Because I've done a lot of Flash and Actionscripting, and "Fast" is not even in the vocabulary. Software rendered graphics pipeline? Check. Slow VM interpreter that makes Java 1.0 look fast? Check. Lack of direct rendering APIs? Check. Focus on animation at the expense of dynamic scene creation? Check.
Granted, Flash 9 is a major improvement, but it is arriving rather late in the game.
Re: (Score:2, Informative)
Re:'polished turd' (Score:5, Interesting)
A user interface? I think you have a very odd definition of "Fast". All you've proven is that Flash is designed to do pretty animations. Well, that's kind of the point. Not to run "Fast". "Fast" was never a part of the design. Just look up the "Actions" portion of the Flash 8 spec sometime and you'll be utterly horrified.
That being said, Flash does do animations well. That's what it was designed for. As a result, it has even been used to create games [newgrounds.com]. It never did games all that well, but Moore's law eventually made it possible to come up with some fairly decent stuff.
Of course, if you're referring to "my Flash animations move faster than my DHTML animation", that's just plain user-error. The Flash animations work better because Flash Studio works out all the timings of the motions for you. If you Actionscripted your motions, they'd come out about the same as they would in Javascript. (And being nearly the same language, it's possible to try the same motion code in both.)
This issue is what the Javascript PVL is intended to solve. i.e. A standard framework for providing animation/motion with minimal input from the developer.
Re: (Score:2, Troll)
Of course, if you're referring to "my Flash animations move faster than my DHTML animation", that's just plain user-error. The Flash animations work better because Flash Studio works out all the timings of the motions for you. If you Actionscripted your motions, they'd come out about the same as they would in Javascript. (And being nearly the same language, it's possible to try the same motion code in both.)
Completely and utterly false.
JS interpreters are not optimized to do image manipulation, DOM updates, etc. Now this isn't to say they aren't moving in that direction, but as of now they are atrocious at these tasks.
Flash is a completely separate environment from the browser, is vector based and inherently performs animation better. Right now it's always faster(CPU %) to do an animation in Flash then it is to do the same animation in JS.
Regards,
Re:'polished turd' (Score:5, Insightful)
Whiskey Tango Foxtrot. Optimized for image manipulation? You do absolutely ZERO image manipulation in Javascript. Same with Actionscript. All that is pushed down into the Canvas and Flash rendering engines, respectively. Same thing with DOM manipulations. Sure, you say "insert this item" or "delete this object", but it's the C/C++ engine under the covers that does the heavy lifting.
People haven't done their own image manipulation since Amigas stomped the earth.
You make that statement, yet you posted a benchmark that showed Javascript to be faster than Flash. I'm rather confused. You do realize that the benchmark you posted below was in millisecond and not operations per second, right? i.e. Lower is better.
You have zero evidence for your statements. Listen to someone who actually knows something about these platforms. There's no reason why Javascript can't perform the same function as Flash using the Canvas APIs. And you know what? That's not a bad thing.
Re: (Score:3, Informative)
Lower is better.
Got it.
Array join (array size 1000, 500 iterations)
JS: FF2 - 375ms, Flash - 303ms
substring (10000 iterations)
JS: FF2 - 16ms, Flash - 3ms
Did you look at the link I posted at all? Even the older versions of Flash were split with JS ~50/50 on the various datapoints.
I'm not implying it's a bad thing to try, but seriously. Did you even look at the JS code that is your "framework" to this stuff? Let me grab you a piece:
do {
Re: (Score:3, Insightful)
Actually, you should check my post below as I explained in detail why Flash lost that handily. The short version is that Flash 9 is not comparable right now because the VM is not in use by many projects. By the time it's in heavy use, FireFox will be using the exact same engine.
Sure. And the piece you picked (like most of the code) is motion computations. The piece you picke
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
http://www.oddhammer.com/actionscriptperformance/set4/ [oddhammer.com]
don't know the accuracy, but interesting nonetheless.
Re:'polished turd' (Score:5, Insightful)
The secret to the performance of Flash 9 is this little beauty: http://www.mozilla.org/projects/tamarin/ [mozilla.org]
A fully modern, high-performance, Just In Time compiler that gives the JVM a run for its money. It's an amazing piece of Javascript technology that Adobe has donated to the Mozilla project for inclusion in the next major revision of FireFox. Wonderful, wonderful engine that absolutely no one is using yet.
See, if you compiled to Flash 7 or 8, you're still triggering the Flash 8 engine. The Flash 9 engine is a complete rewrite that only works with Flash 9 content. So the next chapter of performance wars has yet to be written.
Q.E.D.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Er, except for Flash 9. Which it was originally written for.
Re: (Score:3, Informative)
Re: (Score:3, Interesting)
Who still haven't produced a critical mass of software yet. In fact, there are very few Flex sites in existence. Adobe's exit from the J2EE market hasn't helped their case one bit.
Papervision 3D was created for Flash 8 [googlecode.com] and ported to Flash 9 [googlecode.com]. If you see a Papervision app, there's a g
Re: (Score:3, Informative)
Re: (Score:2)
Re: (Score:2)
It also take significantly fewer request to load(i.e. 2) then a normal site.
Re: (Score:2)
Re: (Score:3, Insightful)
Re: (Score:2)
Which is why the Tamarin [mozilla.org] project exists.
Re: (Score:3, Funny)
Re: (Score:2)
Kind Regards,
Re: (Score:2)
Flash is just Adobe Javascript (Score:4, Informative)
All this shows is just how terrible most browser's Javascript engines really are. Notice, modern browsers do considerably better on these demos than older ones, mainly because so much of the web has shifted to using Javascript and dynamic content, such that JS becomes a limiting factor in usability. Once JS engines have caught up to ActionScript in speed, what more use do we have for Flash? We already have Mozilla working to make use of the Tamarin byte-code engine, which will turn JS from being a slow, interpreted language into being a byte-code compiled language (speed on the order of modern scripting languages such as Python/Ruby and to some extent Java/C#).
So sorry, Javascript is the right tool for the job. It's the only tool for the job as far as Open Standards are concerned.
Re: (Score:2)
Re:'polished turd' (Score:4, Interesting)
If you prefer think of this as Processing on Canvas, rather than Processing on JavaScript, because Canvas is the enabling technology here.
And I don't know where you get off calling it a "polished turd". (Makes me want to poke around your homepage-vertisement, and see if you have a right to make those judgements)
The Java requirement was always a pain to deal with before, and this "polished turd" removes that and makes visualizations much more portable and easier to play around with.
Also the moving visualizations have always been CPU intensive, that's the nature of what they are; they're supposed to be easy to create visualizations of data, it's not a video game. It was like this on Java too.
Note that the static practical visualizations, which take dynamic data, draw the visualization and then end, need much less CPU than dynamic ones like you might see in a flashy demo.
This is a very good thing, and a very welcome surprise; Processing really does offer something that's pretty unique, and I look forward to seeing more of it. Kudos Resig
Re: (Score:2)
Bram Cohen (bittorrent guy) had a JavaScript game of life on his page at one point, which used tables instead of Canvas, and it was much, much slower on a much, much smaller grid. (I can't find a link for comparison now though)
Re: (Score:3, Insightful)
Re: (Score:2)
I should have said "in an optimized manner" instead of 'fast'. Instead of splitting hairs my point is that Flash is designed to do particular things and has the tools to do them in a reasonable way.
JS does not.
Re: (Score:2)
Re: (Score:2)
But then, most of my complaints about Flash are its video playback.
Second Step (Score:5, Informative)
Second step, actually. Apple and the WHATWG [whatwg.org] took the first step by introducing the Canvas API to the HTML 5 spec. That gave web developers the ability to do Flash-like content. This language is the second step, in that it gives programmers a standard framework from which to create impressive animations.
Kudos to Mr. Resig on a job well done! I can't wait to play around with this project more.
Not going to happen (Score:4, Insightful)
Re:Not going to happen (Score:5, Insightful)
You know, I recently heard about a project by John Resig (creator of jQuery) called Processing.js. It's a Javascript port of the Processing Visualization Language, which means it could be viewd as a rival to Flash for online graphics content.
You should check out his blog post [ejohn.org]
In case the sarcasm wasn't obvious enough: that's one of the most important things that Javascript libraries solve
Re: (Score:3, Funny)
Wow! A library that helps people detect sarcasm...that IS a killer feature!!!
Re: (Score:3, Informative)
Javascript is far too fragmented to be a competitor to flash.
The author's most famous project, jQuery [jquery.com], addresses this weakness, though. It is a smallish framework that does a very good job abstracting you from the browser-to-browser differences in Javascript.
I haven't played with this new toy of his, but it stands to reason that he'll take the same care with it that he did with jQuery.
In other words, Javascript may be too fragmented, but this Processing language is not... and you write your code in Processing, not Javascript.
Re: (Score:2)
No. That's why I can play the same Flash games on my Windows and Linux boxes, the Mac test box at work, my Wii, one of my cell phones and soon the iPhone. For rich media, Flash is significantly more reliably portable than basically anything other than Java, and Java's lead is steadily waning.
And what would you suggest I'm lampooning? Or didn't you know that satire was the imitation of an extant work with changes injected for the purpose of exposition and mockery? (Mad
Re: (Score:2)
From your prior reply, it's actually quite obvious that you don't know what portable means, since you confused it with prevalence. Portability is not a question of being available on your platform of choice. Portability is a question of things working wherever it is available. If mono was 100%, then .NET would be rigorously portable, even though there were only two implementations out there for two platforms. Portability is not impeded by that people have not c
Re: (Score:2)
Well, if that were correct, then indeed they would be. However, ActiveX is plagued with portability problems through various versions of ActiveX as the various early faulty loading mechanisms were shut off, one by one, as they were discovered to be irreconcilably insecure.
It's not actually a unique definition; it's taken
Re: (Score:2)
That was meant to say "per year".
:
I also meant to post this quote from the Adobe article, just to drive home how much your research skills fail to impress (remember, this is straight from adobe.com [adobe.com], so spend some time sucking dick quietly in a dark corner before finding it "hard to believe")
This has been well kn
Re: (Score:2)
Just because the platform doesn't appear on every platform doesn't mean that the platforms it does appear on are in any way bifurcated.
Re: (Score:2)
Yes it does. [palm.com] (And that's only one of many implementations.)
Re: (Score:2)
Rival?! (Score:2)
Javascript being a rival to Flash for online graphics content
The article submitter has clearly never actually used the HTML canvas object. There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.
It is very handy to have though, apart, of course, from having to perform kludgery to get it working roughly in IE (by using excanvas.js to emulate the canvas object in VML).
Re:Rival?! (Score:5, Informative)
Oh? I have, and I don't disagree. Of course, I've USED Flash quite a bit too, so I know how God-aweful slow that platform was up until version 9.
Why not? Flash == Software renderer. Canvas == Software renderer. Actionscript == ECMAScript engine. Javascript == ECMAScript engine. I'm not seeing the issue.
Hell, once FireFox is on the Tamarin engine, the two platforms will be practically the same!
Re: (Score:2)
The difference is, of course, that Flash will be hardware accelerated when Adobe damn well pleases, and there's nothing we can do about that.
Re: (Score:2, Informative)
The article submitter has clearly never actually used the HTML canvas object. There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.
I have used the HTML canvas object. It's not on par with Flash 9, which is why I wrote "a first step towards Javascript being a rival to Flash". I styled that to help you with reading comprehension. Processing.js is an enabler that will lower the bar for many developers and give it the attention needed to improve the weaknesses that exist.
Re: (Score:2)
There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.
You're not very imaginative. Once JavaScript has the same JIT as ActionScript [mozilla.org], the language will be just as fast. And once Canvas has a hardware accelerated 3D API [mozilla.org], it'll be much faster than Flash. 3D content in Flash is extremely slow and takes up a lot of storage space, because it has to be converted to 2D content beforehand.
Eric (Score:5, Insightful)
Other than that, Mrs. Lincoln, how was the play? (Score:5, Insightful)
Don't get me wrong, I think its a cool toy I will be playing with, but until it actually works in more than one beta browser, its is no threat to Flash at all.
-Em
Re: (Score:2)
Don't get me wrong, I think its a cool toy I will be playing with, but until it actually works in more than one beta browser, its is no threat to Flash at all.
You mean like say, FireFox AND Webkit?
No, if you have bothered to read TFA, only beta of firefox 3 is fully supported and nothing else. Webkit is a little more supported than anything mainstream, but latest nightly Webkit (not even a beta!!) can do image handling, but not pixel or text processing.
-Em
JS a rival to flash? (Score:2)
Riddle me this... (Score:2)
Re: (Score:2)
Re: (Score:2)
In Javascript's defense, I don't think it was originally intended for programs more than a couple of pages long.
Python will be ubiquitous after they redesign the syntax. Preferably towards a Smalltalk-like
even if its wonderful, its bad.. (Score:2)
quite so. The more lovable and perfect it is, the more disruptive it will be to a staggering volume of interactive bits that legions of coders have tucked into all the pages on the internets. We paid a VERY high price for "run everywhere".
Re: (Score:2)
and the dozen hoops to jump through if you what to imitate the innate data hiding of a real OO language.
It's actually pretty trivial to do that, though I would argue it's much better to simply specify, in your documentation, what your public API is.
The way a function namespace comes from the context of its definition rather than invocation
That's a feature. It means all functions are automatically closures, which makes for some very cool Lisp-like possibilities.
Not going to disect your entire post -- whether it was your intent or not, one gigantic paragraph is annoying to read -- but here:
A quick article [crockford.com]
Or, check out the YUI Theater [yahoo.com], in particular things like "The JavaScript Programming Language" a
learning Processing (Score:2)
This summer my goal is to start working with Processing. I'm at home in C/C++/Lisp and I have a tiny bit of experience with openGL (probably safe to assume it's worthless though - I pretty much recycled other folks' shaders when I was working with it). Do any folks here have some advice, such as where they started when they began working with Processing? Thanks
Re: (Score:2)
Processing is extremely easy if you have previous programming experience. It's really just Java with a simple IDE and some automatically-loaded libraries; when a Processing 'sketch' compiles, it's actually wrapping it in a Java class and building that.
Re: (Score:2)
http://www.vimeo.com/935317 [vimeo.com]
It seems things like that represent a couple years of experience (stuff like the magnetophysics of the ball) but I like to get my hands as dirty as possible, as quickly as possible.
Re:My Post (Score:5, Funny)
Other than that your post was completely relevant.
Re: (Score:2, Funny)
Re: (Score:2, Funny)
Re: (Score:3, Informative)
Re:My Post (Score:5, Funny)
Vincent: It's not. It's the same ballpark.
Jules: Ain't no fsckin' ballpark neither. Now look, maybe your method of programming differs from mine, but, you know, writing a web page, and coding for the JVM, ain't the same fsckin' ballpark, it ain't the same league, it ain't even the same fsckin' sport. Look, Javascript don't mean shit.
Re: (Score:2)
Jules: Whoa, whoa, whoa, whoa... stop right there. Javascript and Java ain't even the same fsckin' thing.
Vincent: It's not. It's the same ballpark.
Jules: Ain't no fsckin' ballpark neither. Now look, maybe your method of programming differs from mine, but, you know, writing a web page, and coding for the JVM, ain't the same fsckin' ballpark, it ain't the same league, it ain't even the same fsckin' sport. Look, Javascript don't mean shit.
I _have_ seen someone thrown out the window for coding in Java.
Re:My Post (Score:5, Insightful)
Re:My Post (Score:5, Interesting)
Re: (Score:2, Insightful)
Re: (Score:3, Insightful)
So you mean it's highly ubiquitous language with 100s of billions of lines of code written in it that spreads over innumerable applications?
Pretty much. Both Java and COBOL blow great big donkey chunks, but they're both used all over the place. They both have this great property of making it difficult to shoot yourself in the foot, which makes it practical to unleash hordes of medium/low quality programmers on a code base and actually come up with something that kinda sorta works.
Re: (Score:2, Informative)
Re: (Score:2, Informative)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2, Insightful)
You nowhere near describing a stackbased cpu with the java language, it's not low level, ok?
Ummm, the Java byte-code is the embodiment of a stack based language, what with its operand stack and stack frames. You would have a point, if you had insisted on a register-based cpu...
if you ever done low lewel you know what I mean
I haven't written, but I have read enough assembler to see a disturbing amount of similarities: unconditional jumps, labels, bitwise arithmetic operations, reading and writing to registers (local variables). Sure, there is more freedom when it comes to declaring the operands for any instruction. Sure, the JVM checks the bo
Re: (Score:2)
Re: (Score:2)
It gets a bad rap because poor developers will use that power to write powerfully terrible code, and "smart" developers will typically use that power to write clever but unmaintainable code.
Re: (Score:2)
Man, there's a whole raft of jokes just waiting to come out of that statement.
But I'll refrain -- I don't want to offend anyone with a thpeech impedimenth.
LISP and JavaScript (Score:2)
I don't know where you learned to program, but you have a VERY warped view of programming languages. Javascript is not a power-users' language by any means. Furthermore comparing it to Lisp is an insult to Lisp, the programmers who use Lisp, and any machine that Lisp has ever been run on. Javascript sucks donkey.
Sorry sir, but you are quite wrong. Please see this page [crockford.com].
Recursive, functional programming can indeed warp your mind if you are referring to that???
Re: (Score:3, Interesting)
Maybe you should actually look up the very history of Javascript -- the programmer wanted an embedded LISP. Some PHB-type wanted it to look like C, so it would be more approachable. So he took his embedded LISP and gave it a C-like syntax.
Or maybe you should've Googled about Lisp and Javascript. Here, go read. [crockford.com]
Re: (Score:3, Informative)
Seriously, you should at least *understand* the languages before you talk nonsense.
Re: (Score:2, Funny)
Re:Creator of WHAT?! (Score:5, Insightful)
Can someone please explain to me why anyone would regard jquery as a black mark on John Resig's work?
I've found it very useful for anything but the most mundane js tasks. Certainly better than the piles of other libraries that all seem to be based around the fallacy that javascript needs classical inheritance. (Hint: It doesn't. It has prototypal inheritance.)
Re: (Score:2)
Re:Creator of WHAT?! (Score:5, Insightful)
Re: (Score:2)
Beyond that, I don't understand the point of the question? If you're turning on NoScript, you doubtless have NoFlash or something similar anyway.
Re: (Score:2)
You still have to contend with the awful Javascript language though. The engines are slow because the language is convoluted.
SVG should be the future. It'
Re: (Score:2)
It wouldn't be my first choice, but I don't think either of those really apply. There are a few weird syntax issues, but it's pretty much Lisp in C's clothing, and actually enjoyable to work with, once you really know it.
And Tamarin will make it fast.