So what I need is to somehow include assembly instructions into my project I don’t have time for a lot of complicated things that I cannot understand. If building a library is the easies way to do it then I have to take that route whatever it costs. Please help me.
wouldnt using assembly make your Processing 3 project platform dependent?
Unless you are referring to Java bytecode, Java Native Interface would probably be the way to go.
I am curious what you are working on given your apparent need for low-level execution.
I would not expect a lot of speedup above using C/C++.
That is a note on the amount of work put into compilers and not a comment on your skills.
Some things to consider in addition to being platform specific as mentioned by @mgood7123:
Will this be under an operating system? (very likely if using a virtual machine: Java)
How much data will need to be processed? (transferring from Java to your library)
Multithreading? (locks, blocking writes, etc)
File access?
Might you get a speedup using resources like shaders in OpenGL? (not sure what is being processed…)
Will you run your Java code on a “Just In Time” (JIT) capable virtual machine
If you are looking to gain from using single-instruction-multiple-data (SIMD) machine code, consider the following:
for (int i=0; i<N; i++)
{
process( array1[i] );
process( array2[i] );
process( array3[i] );
}
If N is large, it may be more efficient if written as:
for (int i=0; i<N; i++)
{
process( array1[i] );
}
for (int j=0; j<N; j++)
{
process( array2[j] );
}
for (int k=0; k<N; k++)
{
process( array3[k] );
}
The speedup comes from allowing the CPU to work on a single array at a given time.
That means the array, or parts of it, can be cached.
Similarly:
// Working with four arrays at once
for (int i=0; i<N; i++)
{
output[i] = array1[i] * array2[i] + array3[i];
}
May be rewritten and can get a speedup
// Work with two arrays at once
for (int i=0; i<N; i++)
{
output[i] = array1[i];
}
for (int j=0; j<N; j++)
{
output[j] *= array2[j];
}
for (int k=0; k<N; k++)
{
output[k] += array3[k];
}
See previous related discussion:
There I asked:
Do you mean you want to write your own JVM bytecode? Or do you mean calling out to a C library with inline assembly from Processing, e.g. through JNI?
I still want to know that. Do you understand that Java runs as bytecode on JVM?