QSharp icon indicating copy to clipboard operation
QSharp copied to clipboard

poor performance

Open pquiring opened this issue 7 years ago • 4 comments

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 avatar Mar 29 '18 19:03 pquiring

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

pquiring avatar Jul 30 '18 20:07 pquiring

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

pquiring avatar Aug 10 '18 13:08 pquiring

Performance is still an issue.

pquiring avatar Aug 31 '18 14:08 pquiring

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

sgf avatar Jan 06 '19 17:01 sgf