Implement Matrix operations in Java or in C++ through JNI? -
i trying accomplish mna(modified nodal analysis) in java circuit solvers . involve solving ton of linear equations , ended matrix algebra . mtj , couple of other java libraries great i'm tasked implementing on own , did in java since entire project in java. wondering if should go ahead java implementation or doing in c++ through jni give better enough performance warrant implementation? i'm concerned bottleneck jni incur when passing matrices order of ten thousand , above or not problem?
my strongest recommendation not attempt optimise code performance develop it. impossible know ahead of time code needs optimising. end less readable, maintainable code doesn't perform better.
develop library in java aiming maximum clarity , correctness. ignore performance.
benchmark performance against realistic loads. example if need process millions of matrices test how long take.
decide if have problem. modern hardware coupled performance elements of jre mean there far fewer situations in needs done @ stage. if needs done, consider running on more powerful machine instead of optimising code. that's cheaper option.
if need optimise code, use profiler find bottlenecks. there few small areas consume majority of resources. can waste lot of time optimising code has little impact.
optimise code in bottlenecks. there ton of resources out there this. rerun benchmarks regularly make sure making difference. unwind optimisations turn out make no difference.
Comments
Post a Comment