Why is C# so slow in this benchmark vs Java

  • Thread starter Thread starter Ralph Mason
  • Start date Start date
R

Ralph Mason

I was looking at this page

http://www.garret.ru/~knizhnik/dybase/doc/dybase.html

And noticed running the same code (Java ported to C# using the MS tool I
expect) that the C# implementation is over 50% slower than Java in all
tests. Coming in at the same speed as Ruby, which isn't known for it's
speed, but is totally dynamic and interpreted. Something doesn't seem quite
right.

Color Language Database
1 C++ GigaBASE
2 Java PERST
3 C-Sharp PERST
4 Ruby DyBase
5 Python DyBase
6 PHP DyBase



Index searches per second
1 297177
2 76923
3 28571
6 9524
4 9091
5 8961


Stored objects per second
1 45600
2 14285
3 7142
4 6667
5 6072
6 5555


Removed objects per second
1 39308
2 20000
3 6250
4 6250
6 4615
5 4545
 
Yeah, the C++ implementation should probably not have been over 10 times
faster in the benchmarks either. I think something else is being
benchmarked here. Perhaps our gullibility???
 
I was looking at this page

http://www.garret.ru/~knizhnik/dybase/doc/dybase.html

And noticed running the same code (Java ported to C# using the MS tool I
expect) that the C# implementation is over 50% slower than Java in all
tests. Coming in at the same speed as Ruby, which isn't known for it's
speed, but is totally dynamic and interpreted. Something doesn't seem
quite right.

As with any benchmark using a database: you're testing the database
driver, since that's the bottleneck. Apparently, the guy who wrote DyBase
hasn't come up with a very good C# driver.

FB
 
I don't think there's enough information there to draw much of a conclusion.
We don't know how the database is accessed nor is there a link to the code
that he used. We don't even know (for example) if he compiled with
optimization turned on.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Eric Gunnerson said:
I don't think there's enough information there to draw much of a conclusion.
We don't know how the database is accessed nor is there a link to the code
that he used. We don't even know (for example) if he compiled with
optimization turned on.

The code can be found here http://www.garret.ru/~knizhnik/perst.html (both
Java and C# versions)

As I said it's a direct port from the java code.

Ralph
 
Ralph Mason said:
The code can be found here http://www.garret.ru/~knizhnik/perst.html (both
Java and C# versions)

As I said it's a direct port from the java code.

That could be a problem in itself. While similar, Java and C# have
different idioms. Java JITs have evolved to make virtual method calls
very fast when they haven't been overridden, whereas .NET hasn't gone
that way as methods aren't virtual by default. A straight blind port
from the Java would make most of the methods virtual, which could make
a significant different.
 
Back
Top