Comments for PL/SQL Vs. Oracle JVM: Speed Comparison for Mathematical Operations
|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.
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.
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.
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. :)
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?
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.
Jan Matusiewicz said...Have you tried using BINARY_DOUBLE instead of NUMBER? This should be much faster.
Yes. I have an article about the performance of different numeric types.
The point here was the comparison of Java and PL/SQL, not making PL/SQL faster. :)
DO NOT ask technical questions here! They will be deleted!
These comments should relate to the contents of a specific article. Constructive criticism is good. Advertising and offensive comments are bad and will be deleted!