You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had searched in the issues and found no similar issues.
Motivation
As mentioned in PR #2368 in this comment, HnswIndex is a relatively heavy class since it includes mt19937, sizeof(mt19937) ~= 5000), we can try to optimize its construction.
One callout is that mt19937 is not thread-safe, so I'm not quite sure if sharing it among all HnswIndex instances will cause any side effects, will further investigate if we finally use the solution.
Welcome any other ideas and thoughts!
Are you willing to submit a PR?
I'm willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Search before asking
Motivation
As mentioned in PR #2368 in this comment,
HnswIndex
is a relatively heavy class since it includesmt19937, sizeof(mt19937) ~= 5000)
, we can try to optimize its construction.Thanks @PragmaTwice for pointing it out! :)
Solution
One way I could think of to improve it is to make all instances of HnswIndex share a single
mt19937
instance.We can implement a
RandomGenerator
using Singleton Pattern as below:One callout is that
mt19937
is not thread-safe, so I'm not quite sure if sharing it among allHnswIndex
instances will cause any side effects, will further investigate if we finally use the solution.Welcome any other ideas and thoughts!
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: