Code Monkey home page Code Monkey logo

Comments (1)

springmeyer avatar springmeyer commented on August 16, 2024

Update on this ticket: after landing #126 (and the concern that the prefiltering in #126 might be problematic faded away - #131) I think the bottleneck described above is likely somewhat mitigated. We saw that contextSortByRelev was a major hotspot when I presume, we were sorting hundreds or thousands of contexts. After the prefiltering in #126 I think we'll be sorting fewer. However this all should be tested. Someone interested in performance could:

  • profile with perf in production to see if contextSortByRelev is still a bottleneck (https://jvns.ca/perf-zine.pdf)
  • if it is then you could print out (or debug with lldb/gdb) how many context objects we're sorting now - are we still sorting an obscene amount for some queries? If so perhaps we could be even more aggressive than I was in #126 by doing something like:
diff --git a/src/coalesce.cpp b/src/coalesce.cpp
index 9f517d3..c6e2ae5 100644
--- a/src/coalesce.cpp
+++ b/src/coalesce.cpp
@@ -312,7 +312,7 @@ inline std::vector<Context> coalesceMulti(std::vector<PhrasematchSubq>& stack, c
                 } else if (covers[0].mask > covers[1].mask) {
                     context_relev -= 0.01;
                 }
-                if (maxrelev - context_relev < .25) {
+                if (maxrelev - context_relev < .15) {
                     contexts.emplace_back(std::move(covers), context_mask, context_relev);
                 }
             } else if (first || covers.size() > 1) {
@@ -333,7 +333,7 @@ inline std::vector<Context> coalesceMulti(std::vector<PhrasematchSubq>& stack, c
     // append coalesced to contexts by moving memory
     for (auto&& matched : coalesced) {
         for (auto&& context : matched.second) {
-            if (maxrelev - context.relev < .25) {
+            if (maxrelev - context.relev < .15) {
                 contexts.emplace_back(std::move(context));
             }
         }

from carmen-cache.

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.