renatoathaydes / prechelt-phone-number-encoding

Comparison between Java and Common Lisp solutions to a phone-encoding problem described by Prechelt
30 stars 12 forks source link

suggestions to accelerate rust phone_encoder #2

Open omac777 opened 3 years ago

omac777 commented 3 years ago

I understand the original implementations did not consider any parallelism mechanisms at that time since they weren't easy to use.

A few suggestions to accelerate the rust implementation of phone_encoder:

Thank you for listening.

renatoathaydes commented 3 years ago

I would be happy to see what code that does this would look like, and how performant it would be!

But I won't have time to do that myself. Feel free to submit a PR!

If you haven't seen it yet, I've just written a followup post in which I analyse the Rust code in more depth thanks to the guys at #1 : https://renato.athaydes.com/posts/how-to-write-slow-rust-code.html

ElhamAryanpur commented 4 months ago

I'd also like to add while reading the Cargo.toml that, no release profile optimizations were added...

A release profile such as this could improve by quite a bit:

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
debug = false

although at the cost of compile time

renatoathaydes commented 4 months ago

@ElhamAryanpur that was done in my series of blog posts for Rust. See Profile Guided Optimisation in https://renato.athaydes.com/posts/how-to-write-fast-rust-code

Nice! Just by re-compiling with PGO, without having to make any code changes, we get yet another 5% improvement in performance.

ElhamAryanpur commented 4 months ago

@renatoathaydes oh my bad then, I didn't see it. Loved the article truly!

renatoathaydes commented 4 months ago

No problem, glad that you liked it! I should add links to the previous articles, I realized I haven't done that properly yet.