Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

How to zero cost import from ffi? #505

Closed
NilsBarlaug opened this issue Oct 8, 2021 · 3 comments
Closed

How to zero cost import from ffi? #505

NilsBarlaug opened this issue Oct 8, 2021 · 3 comments
Labels
bug Something isn't working no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog

Comments

@NilsBarlaug
Copy link
Contributor

Hi, thanks for the awesome work you're doing!

I tried using import_array_from_c to import a string array as described in guide, but was surprised to find out it doesn't seem to be zero cost (well - not constant cost). If I'm reading the the source code correctly I see that offsets and utf8 validity are checked. Is there any way to avoid this when importing from ffi? The overhead is unfortunately a blocker for my use case.

@jorgecarleitao
Copy link
Owner

Thanks!!

This is a bug. We should use from_data_unchecked, that does not perform any checks, as this is the only API where it is ok to not perform these checks.

Let's release a patch with a fix for this.

Would you like to try it to work out a patch? It is a good first issue

@NilsBarlaug
Copy link
Contributor Author

Ah, okay. I've tried to create a PR 😅

@jorgecarleitao jorgecarleitao added bug Something isn't working no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog labels Oct 9, 2021
@jorgecarleitao
Copy link
Owner

Closed by #510 and released in v0.6.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog
Projects
None yet
Development

No branches or pull requests

2 participants