Performance, Processing vs Flash
Posted: 01 June 2008 12:21 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  41
Joined  2007-02-13

Hey guys

Does anybody have detailed information about the performance differences between Processing and Flash? One thing that strikes me is whether Flash has any kind of hardware-acceleration that can compete with Processing if you are using OpenGL? A couple of years ago we tried to do a CV project with Flash but the combination of Flash and CV computations simply required too much CPU power to work well. However, much can have changed since.

I’m leaning most towards using Processing as I would also like to move to Linux(although you can do Flash on Linux too) and I already have experience with OpenGL(pure, not the Processing implementation) programming.

Does anybody have documentation or experience regarding this? smile

Profile
 
 
Posted: 02 June 2008 02:35 PM   [ Ignore ]   [ # 1 ]
Elite
Avatar
RankRankRankRank
Total Posts:  163
Joined  2007-09-13

Hi, ALJ. I posted the exact same question some time ago in the Software/General category, but didn’t get much response:
http://nuigroup.com/forums/viewthread/1723/

I also had a quick chat at the IRC channel and what I got was basically that it would depend on the application. So, I decided to try it out myself and, so far, these are my impressions:

- MT programming in Flash is sooo much easier because of the excellent framework already developed.
- For Processing, the TUIO class from the Reactivision guys is the easiest way. But it’s far from great, being too focused on fiducials tracking. I might rewrite the whole OSC parsing in the future for optimization purposes.
- For 2D stuff, Flash might be better especially if you’re dealing with text.
- Both platforms run on virtual machines, so none is ideal in terms of performance.
- But… if you’re planning on doing any 3D, Processing just kicks ass. It’s native support to OpenGL makes 3D apps run incredibly smooth if you have a decent video card.
- But… Processing only implements basic 3D functions. You can make direct OpenGL calls, but that is not officially recommended.
- But… that’s all concerning graphics rendering performance. As far as blob tracking goes, I haven’t tested it properly yet. Although I do get a feeling that Flash apps are more responsive. But that could be fixed by optimizing the OSC parser I’m using with Processing. Or not.

I hope I made some sense. Let me know what you think.

Profile
 
 
Posted: 02 June 2008 05:31 PM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  41
Joined  2007-02-13

Hello again!

Funny how we seem to think alike. Almost the exact same topic. I’m also still trying to find enough money for the LG projector. smile

I forgot to mention that my project will actually be mostly based on fiducials so I don’t think it’s a bad thing that it’s fiducial centered.

Well, it’s exactly the graphical performance that worries me. It’s a year or two ago I tried it out with flash and computer vision but I just got this very bad impression of Flash as being very CPU intensive. The main reason I wanted to use Processing is because I have had 3 semesters; C, C++ and OpenGL. I’m not exactly a pro but I’m not bad at them either. For the tracking I wanted to use reactivision. Processing should only be doing the calculations of the content that I then wanted to do with direct OpenGL for the graphics. A full C++ implementation is simply overkill for prototyping in my opinion but Processing might provide an faster prototyping environment along with the much faster graphical performance than flash by utilizing OpenGL. This keeps CV and calculations on the CPU and the graphics on the GPU which seems optimal to me. I know they don’t recommend using direct OpenGL calls in Processing but it seems they don’t recommend it because Processing is supposed to be easy to learn and OpenGL… well, isn’t.

Oh, and yeah. Not having text rendering an integrated part of OpenGL is simply stupid. Yes, I know that OpenGL is supposed to be a very low-level programming language but text is used in SO MANY applications that I still think this ranks very high on my list of worst design decisions ever. I really hope that OpenGL 3.0 will not force newbies to spend hours or even days learning something as simple as just writing 2D letters on the screen. Writing text in OpenGL is like typing by cutting out letters in one color of paper, gluing it to another. It takes forever to get it right, it probably doesn’t look as you really wanted it to and when you finally succeed it’s really nothing special, making you wonder why the heck you just spent so much time doing it. I think this is almost enough reason in itself to start with flash if you are new to both of them.

Thanks for your reply, I think I will test this when I get the time for it - maybe create two similar applications(that will NOT involve text rasberry) and compare the framerates or something like that. I guess that would be the best way to find out. smile

Profile
 
 
Posted: 03 June 2008 02:53 PM   [ Ignore ]   [ # 3 ]
Jr. Member
Avatar
RankRank
Total Posts:  38
Joined  2008-01-31

Remember that Flash/Air and Java are languages that are not compiled to native code. They are compiled to an intermediate code, and run on a virtual machine. I know with Java this posed a problem with efficiency when accessing the camera. For example on the Mac, Java needs to ask Quicktime for access to the camera. This process of having Java run out to Quicktime for camera data hinders performance a lot. This is why I left Java for C++ for my application.

Just something to keep in mind.

Profile
 
 
Posted: 03 June 2008 03:02 PM   [ Ignore ]   [ # 4 ]
Elite
Avatar
RankRankRankRank
Total Posts:  163
Joined  2007-09-13

@ALJ: Yeah, I guess hands-on testing is the only way for a fair comparison.

But from what you said, I have a feeling that Processing will be a safer first bet. Use the “TUIO_Processing” demo available from the Reactivision page as a starting point. Since you’ll be using the Reactivision engine, you wouldn’t get much benefit from using Flash.

For text, you might be able to mix Processing’s own text engine with OpenGL. Even though it’s easier that doing the whole thing in OpenGL, it’s still not nearly as good as Flash’s, mainly because it only supports bitmaped text.

Btw, good luck with the savings for your led projector.  wink

Profile
 
 
Posted: 03 June 2008 03:20 PM   [ Ignore ]   [ # 5 ]
Elite
Avatar
RankRankRankRank
Total Posts:  163
Joined  2007-09-13

Oh, regarding the camera issue with Processing, it is true but it doesn’t apply in this case, because the camera feed will be handled by a separate application: either Touchlib or Reactivision. Processing only has to listen to the OSC packs.

Even though, virtual machines do impose some performance loss. But that also applies to Flash.

Profile
 
 
Posted: 04 June 2008 02:56 AM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  474
Joined  2006-11-09

As a big fan of both Processing.org and Flash (AS3)… Here is my two cents:

Processing offers more power ... however is harder to distribute and develop than Flash…

I personally have slowly migrated away from Processing into Flash mainly because it is so easy to showcase my work… SWFs are easy to share via web… Java never was able to capture browser penetration market.

Also a huge reason I enjoy Flash more is because Actionscript 3.0… its very similar to Java Language however without the insane amount of bloat or complexities.

However Flash Rutime performance is still lower then Java Runtime mainly due to its direct OpenGL API… and overall Java Virtual Machine has had longer time to develop as a native desktop runtime. (ie Java 3D)…

 Signature 

~

Profile