Hacker News new | ask | show | jobs
by Tuna-Fish 2491 days ago
Wouldn't the simplest solution be to just make bindgen emit "from <file name>@<hash>" into the /* automatically generated by rust-bindgen */ comment?

Then when it loads a .h, hash it, and if the hash is unchanged don't write anything. This way, the cargo/rust incremental compilation does the rest of the work. Minimal change to how it works now, yet the compile times go way down.

If you are willing to live dangerously, you could always use modification times instead of hashes to avoid having to even read the .h files on compile, but frankly that sounds like it'd just make enough heisenbugs that people would start doing clean compiles just in case.

1 comments

Caching would certainly help improve the performance of bindgen. But I'd also like to improve the quality of the bindings, avoid the need for a build script to invoke bindgen, and reduce the amount of boilerplate needed to make safe wrappers.