[vox-tech] benchmarking (again)
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Fri Feb 17 09:42:00 PST 2006
Peter Jay Salzman wrote:
> I'm benchmarking doubles versus floats using C++, C, and java on Cygwin.
[...]
> The timings for Float.java and Double.java are wierd...
>
> $ time java Float
> real 0m1.365s
> user 0m0.015s
> sys 0m0.061s
>
> $ time java Double
> real 0m1.318s
> user 0m0.015s
> sys 0m0.015s
>
> What am I to make of the user time here?
>
> And although I didn't show the "real" time for C++, the java real time is
> lower than all the real times for the C++ trials.
>
> How can this be? I thought that java does stuff like initializing all basic
> datatypes to "0" upon instantiation. And I've read that java allocates
> memory for all data items on the heap, which is never stored in L1 cache
> while for C and C++, temporary objects are often put into the L1 cache.
>
> How is java real time faster than C++ real time here?
That looks like an artifact of cygwin. Process management under Windows
is at best an approximation of *nix process management. What you are
timing is the launch process for the Java runtime, rather than the
actual launch of Java or the execution of your code. Use Java's
internal timing functions or do your comparisons under Linux.
I get the following user times on my Kubuntu system:
Double Float
1.605 1.764
1.613 1.824
1.650 1.808
1.614 1.808
1.615 1.791
1.632 1.849
1.616 1.813
1.643 1.857
1.597 1.810
1.652 1.846
avg 1.624 1.817
sdev 0.019 0.028
--
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
More information about the vox-tech
mailing list