Skip to content

Conversation

@marcomd
Copy link
Owner

@marcomd marcomd commented Jun 8, 2025

Description

Now the size of embeddings is static and the RUBY_TYPED_EMBEDDABLE flag is used

  • the size of embeddings is static and defined in two places:
    • c side is defined in ext/rag_embeddings/embedding_config.h
    • ruby side is defined in lib/rag_embeddings/config.rb

Remember to recompile the c extension after changing the size:

rake compile

Performance

bundle exec rspec spec/performance_spec.rb

Embedding creation (10000 times): 136 ms
Cosine similarity (10000 times): 172 ms
RSS: 384.25 MB
.
Memory usage delta: 117.86 MB for 10000 embeddings
.

Finished in 0.65538 seconds (files took 0.09044 seconds to load)
2 examples, 0 failures

On master (w/o RUBY_TYPED_EMBEDDABLE):

Embedding creation (10000 times): 134 ms
Cosine similarity (10000 times): 166 ms
RSS: 211.5 MB
.
Memory usage delta: 55.52 MB for 10000 embeddings
.

Finished in 0.64882 seconds (files took 0.06559 seconds to load)
2 examples, 0 failures

…ag is used

- the size of embeddings is static and defined in two places:
  - c side is defined in `ext/rag_embeddings/embedding_config.h`
  - ruby side is defined in `lib/rag_embeddings/config.rb`

Remember to recompile the c extension after changing the size:

`rake compile`
@marcomd marcomd self-assigned this Jun 8, 2025
@marcomd marcomd added the enhancement New feature or request label Jun 8, 2025
@marcomd
Copy link
Owner Author

marcomd commented Jun 15, 2025

Replaced by this solution #3

@marcomd marcomd closed this Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants