-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Considerations for your API #8
Comments
Hey @CGamesPlay , thanks for the detailed thread! It's really cool to see other people excited about the internals of SQLite and how to make a nice Rust API. Here are some of my thoughts: General
All good points! I should guard some of the newer features of this API depending on the loaded SQLite version. For now I've just assumed people are running with a very recent version of SQLite (3.30 or above), but I should be more careful here
This was done on purpose - I did try a few wrappers around Also, re pointer passing interface, I do have different support of that, with
This library works with statically linked extensions - if you compile with
Totally agree! Already have a few projects that need this. Will take a look at your implementation, thanks for sharing! Virtual tables
You're totally right,
Makes sense, will update!
Same as
Very cool! Will track this in #1
Agreed, but I think this project does have a few different goals. I do want to keep things as safe as possible and have the API be ergonomic. But I really care about performance and keeping things as fast as possible, as evident by leaving Again, thanks for sharing your thoughts, happy to discuss more! |
Great response! Sad to hear your results about wrapping values/contexts. I haven't done any benchmarking on my library yet, as mentioned I'm more focused on ergonomics than performance (obviously performance is important, but I will have to figure out a way to make a performant wrapper). I would actually be surprised if the wrappers that I use cause a performance hit. They take up no additional space (both
Comparing with my implementation: I use Rust's TypeId to automatically create a safe pointer tag. This bypasses the need to define the string tag yourself, and is pretty close to free at runtime. It requires that When I get back into improving the extension, instead of writing the actual extension I want, I'll try to run some benchmarks between the two and see where the gaps lie. |
Hello, I saw your original publication on Hacker News and commented there. It seems like you continue working on this project, which is great, but I have spent a fair amount of effort also thinking about this problem and I can tell you about some of the problems that I encountered in my experience. I am offering you some unsolicited code review for your project. If this isn't welcome, feel free to stop reading here and close this issue 🙂
I'll be referencing sqlite3_ext a few times, for comparison, which I released after seeing your crate but I don't consider it ready yet because many APIs aren't supported. The license of my library is compatible with yours, so feel free to adopt anything you like.
General
Virtual tables
find_function
except through yourdefine_virtual_table_writeablex
function which seems to indicate that you're already unhappy with the way the API is going.Option
, if I want an optional field I'll makeVTab::Aux
optional directly.Application-defined functions
Conclusion
Overall I'm happy to see that Rust support for SQLite loadable extensions is a wanted concept. The primary goal of my API was to be the most ergonomic way of creating SQLite extensions (completely eliminate the use of unsafe code in library consumers, configurable SQLite version targeting, etc.). I don't think there necessarily need to exist multiple versions of a Rust crate for creating SQLite loadable extensions, but I definitely respect if you have different goals for your project.
Happy to answer any questions about why I made some of the API considerations that I did, and again, feel free to lift anything you like from my library and modify it as you wish. Cheers!
The text was updated successfully, but these errors were encountered: