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 (currently 3072) 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): 139 ms
Cosine similarity (10000 times): 157 ms
RSS: 189.45 MB
.
Memory usage delta: 61.03 MB for 10000 embeddings
.

Finished in 0.64975 seconds (files took 0.064 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

marcomd added 3 commits June 8, 2025 20:05
…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`
…flag is used

- the size of embeddings is static (3072 currently) 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