Why is C# so slow in this benchmark vs Java

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
 
J

Jason Smith

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???
 
F

Frans Bouma

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
 
E

Eric Gunnerson [MS]

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.
 
R

Ralph Mason

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
 
J

Jon Skeet

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.
 
E

Eric Gunnerson [MS]

I looked at this a bit, but I'm afraid I wasn't able to reach any
conclusions. To figure out what is going on you'd need to run a profiler on
the code.

--
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top