Forums | Aggregator | Books | Industry News | Firefox Plugins | Social | Links

Comments

PL/SQL Vs. Oracle JVM: Speed Comparison for Mathematical Operations - This article does a side-by-side speed comparison of PL/SQL and the Oracle JVM for some basic mathematical operations.



Mike Smtih said...

Tim,

did you try doing native compilation in plsql?

GERARD Nicolas said...

And did you try the reverse.

From Java to call PL/SQL ?
I guess that you get results reversed. Java will be better than PL/SQL.

It's normal that you get better Performance in PL/SQL than in Java because the PL/SQL engine must do a call to the Java Engine. One step more then poorer performance.

Cheers
Nico
http://gerardnico.com/

Tim... said...

Hi.

I made some totally bogus mistakes in the original article so I've revised it. I think the second test is a lot fairer. :)

Mike: Since both language can be natively compiled in Oracle I though I might as well just deal with the default state.

GERARD: You caught the article in a transitionary stage (whilst fixing the major screw up). I think this version is a little more sensible.

Cheers

Tim...

GERARD Nicolas said...

I'm very surprised that the Oracle JVM is better in simple mathematical performance.

I would have thought that you get reversed results in the same proportion.

I thought that the PL/SQL engine must perform one call to the Java Engine. May be the integration of Java is now really close to the PL/SQL Oracle core engine.

Thanks for this comparison.
Bluffing
Cheers
Nico

Tim... said...

Hi.

I think you've misunderstood the second test. It's not calling PL/SQL from Java. It's just doing the whole of the Java test in one shot, rather than jumping backwards and forwards between PL/SQL and Java.

I'm sure if you repeatedly switched from Java to PL/SQL it would perform as bad as from PL/SQL to Java. :)

Cheers

Tim...

Brendan said...

I wonder about using operations with "2" as the test since especially * and / by 2 are very easy (just bit shift).

Using a prime would be a more thorough test of the maths processing speed I would have thought.

Farhan Ali said...

Hi Tim,
Thats very nice comparison, but i do'nt thing most of the PL/SQL developers know java.
I have one question if you like to answer, When there is a methametical calculation involved that do'nt need to get the data from database frequently, the processing of PL/SQL is performed at client side if for example the client is using oracle Forms as in my case. Where the Java processing will happen, at the cliend side or at the server side?

Regards

Tim... said...

Hi.

If the Form is calling a database stored procedure (PL/SQL or Java) the processing is done on the database server.

You PL/SQL is only run on the client if it is part of the form itself, or in a PL/SQL library in the client. In these cases it is run by the PL/SQL engine built into the forms runtime. Database stored procedures are never run on the client.

Cheers

Tim...

Jan Matusiewicz said...

Have you tried using BINARY_DOUBLE instead of NUMBER? This should be much faster.

Tim... said...

Hi.

Yes. I have an article about the performance of different numeric types.

http://www.oracle-base.com/articles/misc/performance-of-numeric-data-types-in-plsql.php

The point here was the comparison of Java and PL/SQL, not making PL/SQL faster. :)

Cheers

Tim...
Prepared Statement Error: Table './oraclebasecms/cms_page_comment_uuids' is marked as crashed and should be repaired