[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] Native vs. Java Implementation
|
Randy,
I had similar concerns about the speed of a graphics function I wrote
recently. I was creating some objects, calling seven or eight natives, and
it seemed that the whole thing had to be slow compared to a native
implementation. So, I measured the time needed to call the function 10000
times. It took 8012 milliseconds.
Then I rewrote the whole thing as a native method call and timed the loop.
8002 milliseconds. This is on Windows, where the clock resolution is about
10 milliseconds. I was sure the native would smoke the Java implementation
- the improvement just wasn't that impressive. About 0.12% faster.
Certainly not enough for me to keep my natives - I went back to the Java
implementation.
I guess what I'm saying is that I agree with Andrew - object creation may
or may not be as expensive as you think. Without real numbers you wouldn't
convince me to change anything.
-Jesse