Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poor performance #2

Open
pquiring opened this issue Mar 29, 2018 · 4 comments
Open

poor performance #2

pquiring opened this issue Mar 29, 2018 · 4 comments

Comments

@pquiring
Copy link
Owner

The purpose of this project was to create something managed like Java/C# but faster. Short anwser : it's slower.

How could C++ be slower than Java? This prompted me to do some performance tests, and generally C++ code is slower than Java. Only C code was faster.

For this simple example, C/C++ code is slightly faster:

    for(int x=0;x<1024;x++) {
      for(int y=0;y<1024;y++) {
        for(int z=0;z<1024;z++) {
          r += x * y + z;
        }
      }
    }

But when I did more object oriented code, Java was faster:

    ArrayList<String> al = new ArrayList<String>();
    for(int x=0;x<1024*32;x++) {
      al.add(new String("--"));
      int cnt = al.size();
      for(int y=0;y<cnt;y++) {
        String e = al.get(y);
        if (e.equals("test")) {
          System.out.println("ok");
        }
      }
    }

Even when I did a simple test with std C++ objects with highest optimization, it was slower than Java.
When I replaced std objects with simple defined objects and even wrote a simple string compare function instead of the C strcmp() function, only then did the C++ code out perform Java.

@pquiring
Copy link
Owner Author

After trying to get rid of shared_ptr and create a garbage collector the performance is still very bad.

@pquiring
Copy link
Owner Author

Ok, this issue is finally resolved. Q# now offers manual memory management or the Boehm-Demers-Weiser garbage collector.

@pquiring
Copy link
Owner Author

Performance is still an issue.

@pquiring pquiring reopened this Aug 31, 2018
@sgf
Copy link

sgf commented Jan 6, 2019

@pquiring this project is Just the birth begin soon ,the Performance is not the point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants