Processing speed

edited January 2015 in General Discussion

I have some friends who are programmers, and every time we talk, they start telling me, that I should invest more time into learning some serious language (C sharp, or some other alternative), rather than write my programs in Processing which is just a "wrapper of Java".

Their main point is that C#, for instance, is much faster, than Processing. And, as long as, Processing is not even fully Java, it is even slower, than Java.

Now, I am not a programmer, so I don't know much about the "speed" of different languages. Could someone clarify the issue for me. Is Processing really very "slow"? Does it really matter if I run it on my PC, which has more computing power, than, say a tablet.

Answers

  • Answer ✓

    Their main point is that C#, for instance, is much faster, than Processing

    [citation needed]

    both java and c# compile down to intermediate code that runs on a virtual machine. i doubt you'd notice much difference in speed between the two. but you won't be running c# on linux or a mac without a lot of hoop-jumping though.

    (if you'd've said c++ then that would be a different matter as that produces native code that doesn't use a virtual machine. and will generally be faster. but how much depends on so many different things.)

    and processing won't be any slower than java. it's not really a wrapper, it's a library, to make doing graphical things a lot easier.

    get more interesting friends 8)

  • It is not a wrapper for java. It's a dialect as they like to call it. It takes things away like having to declare things public / private / protected. All you can do in java can be done in processing.

    I can also program in other languages like c++ and objective c. And yes they are a lot faster, but if you do things wrong they are slow. I really hate with those languages that you have to declare really a lot. There is the header and the implementation etc. In processing you can have 1 line of code and there is an ellipse on your screen!

    I think processing is perfect if you have to learn programming. There is so much for you to learn that can also be applied to other languages. C++ is quite similar to java, almost every programming language is quite similar to each to a certain degree.

    I really recommend this book: http://mitpress.mit.edu/books/processing-1 I think it's one of the best books I have readed, and I have readed from different languages. The cool thing about it is that you also learn to program in a visual way, which is way more fun then what most programming books have to offer.

    Once you get familiar with processing you will notice that your more often start to read javadocs. Using code for java etc. And one day you probably start learning another language as well. And that will go really quick if you have some experience. And I think for simple things or testing you will still use processing.

    I had to program a pathfinder for example for a application in objective-c. It had to work in venice. But there was no data available about the nodes of how the streets connects. What I did is I took a vector image of the streets and processed that image to get my data in a text format. I think I could not have done it faster then anything other then processing.

  • I want to add one more thing. Lately I see it as a challenge to make things fast. And yeah, processing is slower then open frameworks for example. But often there are good ways to speed up things. I made this once:

    It draws 10.000 rectangles with the average color of the image. For that I made a class that stores the average in a smart way (Integral image it's called). Often there are solutions like that, and this is really good for expanding knowledge.

  • Answer ✓

    Processing does support shaders now, those can be blindingly fast by comparison

    I used Processing to make fractals several times in the past and a few times for very high resolution displays. One on of those displays I made a fractal that took 45 seconds to draw a single image. When I rewrote it using a shader it took less than a second to create the same image

  • Thank you for your answers, I am not sure I will be able to convince my friends of anything, but that is ok)

    I will definitely get the book.

  • edited January 2015

    ... rather than write my programs in Processing which is just a "wrapper of Java".

    • They're right in 1 point: Processing is indeed a "wrapper" framework.
    • However this very same framework is available for other languages besides Java!
    • Like all those "modes": JavaScript, CoffeeScript, Python, Ruby, Android, etc.
    • Even other inspired projects like: P5.JS, OpenFrameworks, Arduino, etc.

    Their main point is that C#, for instance, is much faster, than Processing.

    • They're comparing oranges to apples: C# is a programming language while Processing is a framework for many languages! [-X
    • Since C# is a superset of Java, making a Processing version for it wouldn't be that hard.
    • However, since C# is pretty much a proprietary language bound to Windows niche, just like Swift is for iOS & MacOS, I don't think it's a wise-spent effort! ~:>
    • For higher performance and deployment, making Processing for some system languages like: Vala, D, Go or Rust is a much better option.
    • Or use OpenFrameworks.cc. Although C++ is much harder to tame! 8-X
  • The first thing to say is that Processing is not slower than Java because Processing simply takes what the user types in and behind the scenes converts it to valid Java syntax and hands it over to the Java compiler.

    The second thing to say is that Java is fast because the JIT compiler generates machine code which is then further optimised at runtime by the JVM. See here

    Making generalised comparisons between languages is useless as they all have their own strengths and weaknesses.

  • edited January 2015

    More notes:

    • Of course the approach a framework takes to access hardware libraries like JAVA2D or OpenGL, together w/ the chosen programming language itself, are what most influence performance.
    • We should compare the code quality among other Processing projects like:
      Processing.js (PJS), p5.js, OpenFrameworks.cc, etc.
    • Each framework implementation is unique. And it's more important than the language it was written for! ~O)
Sign In or Register to comment.