r/processing 15d ago

is there speed difference between java, java script, python, c++?

is one more stable than the others?

0 Upvotes

9 comments sorted by

3

u/Nswl 15d ago

Yes. Python being the slowest, c++ being the fastest. Though I’m not sure about pythons processing implementation, but I know for many python libraries they are just wrappers for c++ code, but there is still the extra step when running the code to process those wrappers. And the wrappers are only for functions.

3

u/plastik_flasche 15d ago

Well, technically there is no "slower" or "faster" language... Python with a good compiler can be as fast as JavaScript, or Java sometimes beats C++ because it can make waaay more guided optimizations because of the JIT.

In my opinion the difference is more with the level of abstraction:

In C++ you have to do a lot more yourself, meaning you could write extremely performant code yourself, or extremely slow code.

In higher level languages like python or JavaScript you don't really care about how anything works under the hood, you tell the language to, for example, sort something, and it does. So your performance is more dependent on the stdlib or 3rd party dependencies

3

u/pep84c 14d ago

I made the C++ mode! All of them are pretty fast but in C++ you are basically making direct OpenGL calls and theres no layer of abstraction really so overall C++ is the faster language, Also the C++ mode is currently experimental so if you want long term support I would use Java since Java is definitely more stable and been supported since 2001

1

u/headlessBleu 14d ago

On C++ can you import other scripts in the same folder, or editing the header file, like in a normal C++ project?

Are you Jose Gonzales?

2

u/pep84c 14d ago

Yeah thats me, in the website I have for the project I have a downloadable header file if you prefer to work outside the processing IDE. if you are set on using the processing IDE you want to modify the .h file you can go to the sketchbook folder in your machine which is where modes are downloaded and you can modify and compile your own version with the rebuild-engine.sh script, you can also go to its github and do a PR if you consider its a change thats good for the project which is greatly appreciated. Also yes you can include other .pde files in your folder structure

2

u/headlessBleu 13d ago

thanks a lot. I will switch to C++.

1

u/ElderberryPrevious45 13d ago

C++ can be a true headache. Better be prepared to spend a lot of time in learning it. Maybe better know what you wish to concentrate and select the tools only after that.

1

u/ultradvorka 8d ago

There are differences in speed for sure, but it really depends what kind of application and for who you want to build - real world is more complicated for simple answers like "C++ is faster than Java".

Ad stability: Java, Javascript and Python are interpreted languages - no need to worry about memory management/crashes + it will run (almost) anywhere.