Code Monkey home page Code Monkey logo

Comments (5)

masajiro avatar masajiro commented on May 13, 2024 1
  • There is no result for two of ten queries. Did I miss anything in the parameter settings?

I do not have any idea about that at this moment.

index.search(sc);

Could you exchange the line above for the line below and run again?

index.linearSearch(sc);

linearSearch just executes linear search without the use of the index. If the result is the same as the previous result, it is caused by invalid queries. If not, no result is caused by the index.

  • Is there a way that we can reuse the objects to avoid allocating memory for wide-range and high-frequency queries?

You can move the line below to the outside of the for statement.

    NGT::ObjectDistances objects;

The line below might be needed within the for statement.

   objects.clear()
  • Are there other parameters or compilation options that I can try to improve the CPU performance?

from ngt.

tanliboy avatar tanliboy commented on May 13, 2024

Thank you, @masajiro! It is very helpful.

  • There is no result for two of ten queries. Did I miss anything in the parameter settings?

I do not have any idea about that at this moment.

index.search(sc);

Could you exchange the line above for the line below and run again?

index.linearSearch(sc);

linearSearch just executes linear search without the use of the index. If the result is the same as the previous result, it is caused by invalid queries. If not, no result is caused by the index.

For the first issue, I found it is actually related to invalid query data. Thanks for your suggestions on debugging this situation.

  • Is there a way that we can reuse the objects to avoid allocating memory for wide-range and high-frequency queries?

You can move the line below to the outside of the for statement.

    NGT::ObjectDistances objects;

The line below might be needed within the for statement.

   objects.clear()

I tried with your suggestions. I noticed that ObjectDistances inherits from vector<ObjectDistance> and clearing the vector incurs additional deallocation cost across all results – it is substantial when we have tens of thousands results. On the other hand, the ObjectDistance seems could be reused given it only includes id and distance pair.

If it is reasonable to you to reuse the ObjectDistance for reducing memory cost, I can help with a pull request along the way.

  • Are there other parameters or compilation options that I can try to improve the CPU performance?

I will further explore, thanks.

At the same time, I noticed two small issues:

  • The compiling warning: there are some repetitive declarations for variables that shadow variables in the parent scope. It is triggered some GCC warnings in a verbose mode, and it would be great if we could clear up as well.
  • I noticed that we use iostream to output log outside of the Command file, and I have not found a flag that we can turn off the logging. It lags the perf and seems distracting. Did I miss anything? Or could we add a flag so that we can disable it when needed?

from ngt.

masajiro avatar masajiro commented on May 13, 2024

Did I miss anything? Or could we add a flag so that we can disable it when needed?

There is no flag to turn off the logging. I am going to add a kind of a flag to handle the logging in the near future.

from ngt.

masajiro avatar masajiro commented on May 13, 2024
  • I noticed that we use iostream to output log outside of the Command file, and I have not found a flag that we can turn off the logging. It lags the perf and seems distracting. Did I miss anything? Or could we add a flag so that we can disable it when needed?

I have added arguments to Index and Optimizer to disable the logging.

from ngt.

masajiro avatar masajiro commented on May 13, 2024

*The compiling warning: there are some repetitive declarations for variables that shadow variables in the parent scope. It is triggered some GCC warnings in a verbose mode, and it would be great if we could clear up as well.

I removed most of the warnings that I found.

from ngt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.