Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8013157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:33:29+00:00 2026-06-04T19:33:29+00:00

The reason behind the question For a physics-project, we want to analyze two surfaces

  • 0

The reason behind the question

For a physics-project, we want to analyze two surfaces (specified by a bunch of vertices) and calculate the volume between those surfaces. To be able to do this, we want to implement a two-dimensional interval-search tree. In total the asymptotic run time, will be close to O(n2log n).

The question

In summary we are going to implement an algorithm, which will be quite time-expensive. Furthermore, the algorithm doesn’t profit from the highly optimized math libraries in matlab. Therefore, we are considering to call Java from matlab. Conclusively we would like to know:

"To what degree is Java faster than matlab, ignoring the highly optimized performance from the math libraries in matlab?"

and

"Is there any significant delay when repeatedly calling a java method from matlab?"

e.g. does the JVM have to be started every time the method is called? does the jar have to be loaded every single time the method is called?

I hope some of you could help me (and maybe others) with this question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:33:32+00:00Added an answer on June 4, 2026 at 7:33 pm

    If you decide to write the implementation in MATLAB, here are some very good points @AndrewJanke made in an excellent answer regarding OOP performance in MATLAB (worth reading the whole post):

    Mimicking a C++ or Java class in MATLAB probably won’t be optimal.
    Java/C++ classes are typically built such that objects are the
    smallest building blocks, as specific as you can (that is, lots of
    different classes), and you compose them in arrays, collection
    objects, etc, and iterate over them with loops. To make fast MATLAB
    classes, turn that approach inside out. Have larger classes whose
    fields are arrays, and call vectorized methods on those arrays.

    The point is to arrange your code to play to the strengths of the
    language – array handling, vectorized math – and avoid the weak spots.

    To answer your questions, and I quote the documentation:

    At MATLAB startup, part of the MATLAB virtual address space is
    reserved by the Java Virtual Machine (JVM) and cannot be used for
    storing MATLAB arrays.

    so it is only initialized once at startup.

    Also there is an overhead when calling Java methods as opposed to M-files (since MATLAB types have to be marshalled to and from Java data types).

    Now if you want to squeeze out every last bit of performance, make sure to call Java methods as:

    func(obj)
    

    instead of:

    obj.func()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Question actually says it all. The reason behind this question is I am
Quite simple question, and I really wanna know the reason (the real reason) behind
I have a question which might look silly. Is there any specific reason behind
This particular question is more about trying to see the reason behind compiler message
Here is a link to the reason behind this question: NOW() for DATETIME InnoDB
Is there any reason behind using date(January 1st, 1970) as default standard for time
The reason I am asking this as a separate question to the multitude of
The reason I want to sign the dll is because I want to add
I was trying to identify the reason behind constants in Java I have learned
A beginner question here. My goal: to understand the design rationale behind this. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.