Skip to content

Are the model inference performances diff a lot between differnet code languages(ig. python and java) ? #7157

Discussion options

You must be logged in to vote

How are you creating the inputs for the Java code? Using arrays is much slower than using ByteBuffers, because Java requires that arrays are copied to get into native code and python doesn't require that for numpy arrays (or at least I don't think it does), similarly the outputs are copied when using an array and not when using a buffer.

There may also be slight differences in how the native libraries are compiled for the published Python & Java bindings, so did you compile them from source or use the published ones on PyPI and Maven?

One further consideration is that the Java code will take a little while to warm up, as it has a JIT compiler for best performance, whereas Python is always…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@EasonChow001
Comment options

Answer selected by EasonChow001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants