Skip to content

SIMD and other optimizations #8

@jayay

Description

@jayay

I created a branch to try out SIMD optimizations. It turned out to make a good difference. I added some bench tests to check the differences, just run cargo bench vs. cargo bench --features=simd on that branch.
There's some future considerations to take into account in terms of SIMD, such as core::simd being in the making. Also, as for now, the vector size needs to be divisible by 4.
The simd branch has a lot of changes and optimizations, such as using a HashMap for the vocabulary, which makes the code easier to understand than using a Vec<(String, Vec<f32>)>.
An API breakage was introduced by changing self::Item from String to &String for impl<'a> Iterator for Words<'a>, for the sake of readability and performance in the implementation.

That's a lot of changes and I'd be open to submitting them in smaller PRs.

The full changes are here: https://github.com/jayay/word2vec/compare/master..simd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions