hyperdimensional-computing / torchhd

Torchhd is a Python library for Hyperdimensional Computing and Vector Symbolic Architectures
https://torchhd.readthedocs.io
MIT License
233 stars 24 forks source link

improve ngram performance with JIT #38

Closed aglinxinyuan closed 2 years ago

aglinxinyuan commented 2 years ago

Improve ngram performance by 20%.

random_hv(10,10000) 99.1 µs ± 1.63 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each) 78 µs ± 1.05 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)

mikeheddes commented 2 years ago

Hi, thank you for the PR, good results. However, I don't think the library is at a stage to start micro-optimizing all the functions. If you have an improvement that is still easy to maintain then that would be much appreciated but this improvement takes away from maintainability and understandability which we prioritize higher than efficiency.