ItzCrazyKns / Perplexica

Perplexica is an AI-powered search engine. It is an Open source alternative to Perplexity AI
MIT License
10.84k stars 957 forks source link

perf(backend): only read similarityMeasure once #229

Closed nperez0111 closed 6 days ago

nperez0111 commented 6 days ago

Hi, really cool project. I was just perusing the files when I noticed that this getSimilarityMeasure function is reading from the toml file on each invocation. I would not imagine that this needs to be something that is modifiable at runtime, so I made it only ever check the file once on startup, and each successive invocation re-uses the cached value.

Totally minor performance optimization

ItzCrazyKns commented 6 days ago

Hi thanks for the PR! It reads the config each time as we planned to add a settings option for that in the settings page. This will be implemented when we switch from a settings menu to an entire settings page so there's more space for things like that. Some people might want to change how the similarity is calculated.