Skip to content
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

Port C code to Rust #1

Closed
sdroege opened this issue Jan 6, 2020 · 6 comments
Closed

Port C code to Rust #1

sdroege opened this issue Jan 6, 2020 · 6 comments

Comments

@sdroege
Copy link
Owner

sdroege commented Jan 6, 2020

This should be possible to do incrementally

@jneem
Copy link

jneem commented Jul 30, 2020

I don't have much bandwidth to spare for this right now, but if you put a branch somewhere then I could probably port a function or two when I have a minute...

@sdroege
Copy link
Owner Author

sdroege commented Jul 30, 2020

Thanks, will do :) I have basic infrastructure (also for comparing correctness and performance) done and some functions ported, but need to clean things up a bit more first.

@sdroege
Copy link
Owner Author

sdroege commented Aug 5, 2020

Actually I have most of it done already, just the actual input code is missing and plumbing.

@sdroege
Copy link
Owner Author

sdroege commented Aug 7, 2020

Oh I forgot to link to the branch: https://github.com/sdroege/ebur128/tree/rustify

I have the filter almost done too, after that the next step would be to delete all remaining C code as that's mostly plumbing at that point.

sdroege added a commit that referenced this issue Aug 9, 2020
The remaining audio processing function (calc_gating_block) is about 1.5%
faster in its Rust version than the C version.

Overall the Rust version is currently
 - 9% slower with all features enabled but not histogram mode
 - 2% slower with all features enabled in histogram mode
 - 1% to 2.5% slower in M/S/I modes (with and without histogram)

There are various obvious optimizations to do.

Fixes #1
@sdroege sdroege closed this as completed in adc557d Aug 9, 2020
@sdroege
Copy link
Owner Author

sdroege commented Aug 9, 2020

Ok, this is all done now. Some obvious further optimizations to do but overall the two implementations are very close in performance (Rust is a bit slower, usually around 2%). On my machine they both give the same results (difference is less than 2 ULP), on travis tests are failing though which I'll have to investigate.

@sdroege
Copy link
Owner Author

sdroege commented Aug 9, 2020

Also overall around -1000 SLOC for the whole implementation if ignoring the tests and bindgen generated FFI part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants