data-mining-in-c icon indicating copy to clipboard operation
data-mining-in-c copied to clipboard

Precompute compressed lenghts of the training data

Open rdno opened this issue 2 years ago • 1 comments

Hi,

I came across this implementation. I had an idea to speed up the computations. I don't expect you to merge it.

By pre-computing and storing the compressed lengths of the training data, one deflate call can be avoided in ncd function. I've observed ~33% performance increase.

Great project.

Thanks.

rdno avatar Jan 14 '24 21:01 rdno

What about precomputing the compressed lengths of the test data while keeping the original text around (same for the training data) as well? (Possibly pouring some threads for that.) So, the only final computation will happen in the combined. I'm not too familiar with C, but I used a similar albeit naive approach in Kotlin, which is pathetically slow.

[edit] I poured actual threads, got ~5secs per test sample (still slow for me) using my suggestion. will try SIMD next

gyreas avatar Jan 28 '24 12:01 gyreas