9 ms·
How Rust 1.64 became faster on Windows
- eventhorizonpl 4y agoIt's great to see every speed up :)
- deleted 4y ago[deleted]
- aliqot 4y agoI think your comments are being suppressed, they're all removed after you post. You might check on that.
- nalllar 4y agohttps://news.ycombinator.com/newsfaq.html https://news.ycombinator.com/newsfaq.html Look at the [dead] section
- aliqot 4y agoA single flagged comment and we've declared someone irredeemable. Amazing. https://news.ycombinator.com/item?id=31738035 https://news.ycombinator.com/item?id=31738035
- wongarsu 4y agoGreat to see how huge the benefit of profile-guided optimization is. I feel it's one of the more underappreciated techniques. Rust adding support for it on windows, and showcasing what a big improvement it makes on the compiler is pretty big (in addition to just having a faster compiler)
- mhh__ 4y agoI did pgo builds for the D compiler, was about 10% to 30% even on some benchmarks. The subtle win is the space savings, no more Jackson pollock inlining
- londons_explore 4y agoUnfortunately, many projects never benefit from PGO, because there is quite a lot of complexity involved in setting up a profiling workload, storing the profile somewhere, and using it for future builds. I'd like compiler writers to embed a 'default profile' into the compiler, which uses data from as much opensource code as they can find all over github etc. This default profile will improve the performance of lots of libraries that everyone uses, and will probably still help closed source code (since it will probably be written in a similar style to opensource code).
- pca006132 4y agoI think you can already build shared libraries with PGO, although this doesn't really work with header only libraries for C++...
- darksaints 4y agoI think a cool project to work on would be model-based ML-generated profiles that takes a set of parameters like: * application type (e.g. client, server, batch process, parser, etc.) * target architecture, vendor, model, etc. * target resources like RAM, HD Types, Network interfaces, etc. I would think you could get very close to an actual PGO level of performance with just a handful of parameters and lot of data.
- bruce343434 4y ago
- dijit 4y agoWhat is the common consensus on benchmarking test suites in Rust? From what I understood: Criterion was the gold standard, but there is a built-in benchmark suite but that is only supported in Nightly. What’s the difference?
- throwup 4y agoCriterion is still the gold standard. Pros for Criterion over the stdlib: https://github.com/bheisler/criterion.rs#features https://github.com/bheisler/criterion.rs#features Downsides of Criterion: https://bheisler.github.io/criterion.rs/book/user_guide/known_limitations.html https://bheisler.github.io/criterion.rs/book/user_guide/know...
- dijit 4y agoThanks throwup!
- dochtman 4y agoThere's the bencher crate as well, which provides a similar API to nightly through macros that work on stable. On one of the projects I maintain we reverted from criterion to bencher because the criterion results sometimes made no sense.
- superjan 4y agoTLDR: Profile guided optimization was not supported on windows. That has been enabled now. So this only helps you if you are compiling on windows and want to go the extra mile of running PGO builds.
- itamarst 4y agoThey're shipping PGO builds of the Rust compiler, so for faster compilation you don't have to do anything ("Windows builds now use profile-guided optimization, providing 10-20% improvements to compiler performance", per Rust's release notes: https://github.com/rust-lang/rust/blob/master/RELEASES.md https://github.com/rust-lang/rust/blob/master/RELEASES.md).
- bogeholm 4y agoAfter enabling PGO, that was used to compile `rustc` itself. So compiling Rust code on Windows is faster with 1.64 than 1.63.
- hinoki 4y agoI thought PGO instrumentation works on basic blocks, and the inlining, outlining, and register allocation optimisations are all done on llvm’s IR. So everything can happen in the backend. What sort of work is OS specific, or language specific? I’ve used PGO before, but I’m not familiar with the details.
- Someone 4y agoComputing the profile wasn’t possible on Windows FTA: But there is one problem: PGO was up until now available only on Linux. I think they couldn’t use a profile generated on Linux because of differences in ABI and standard library. I also think generating a profile is OS dependent because you want it to not have much of a performance impact.
- hinoki 4y agoAh, so they could probably generate an instrumented binary for Windows, but there was no infrastructure to actually collect the counts. That would be a lot of work to set up!
- mastax 4y agoTldr: PGO https://github.com/rust-lang/rust/pull/96978/ https://github.com/rust-lang/rust/pull/96978/
- deleted 4y ago[deleted]
- tyingq 4y agohttps://archive.ph/5nvje https://archive.ph/5nvje
- SimonV1235 4y ago
- sorz 4y agoIs it possible that the profile is over-fitting to the benchmark tests?
- varajelle 4y agoYes that's likely. But the idea is that even if that's the case, it is still better than no PGO. Edit: I'd like to add that if the 10-20% mentioned is measured on the benchmark that was used to do the pgo, then that figure might indeed not be representative of the real gain.
- Tuna-Fish 4y agoTheir main benchmark test is compiling every publicly released crate on crates.io. This is also their main regression test. If you manage to overfit against that, it's still probably an amazing general purpose solution.
- DeathArrow 4y ago
- pas 4y agoNowadays it's possible to opt for a best of both worlds situation: https://tauri.app/ https://tauri.app/ or https://github.com/sciter-sdk/rust-sciter https://github.com/sciter-sdk/rust-sciter
- geodel 4y agoOn the third hand are people who use VScode to write Rust code and claim tools based on electron is the way to go.
- Thaxll 4y agoThere is no viable alternative to Electron that is truly multi-platform.
- jeff-davis 4y agoFor databases, I'm reluctant to rely on PGO (profile-guided optimization) because the workloads are so varied. There's a risk of over-fitting to the profiled workloads at the expense of others. Though there may be a lot of opportunity with some database subsystems that have a more consistent usage pattern. Edit: also, PGO is closely related to JIT techniques, which are based on current runtime information rather than profiles generated a long time ago on a workload that may or may not be representative.
- vlovich123 4y agoI think in practice enabling PGO will be a net gain even if it’s suboptimal on some workloads (ie you should still see some performance gain across the board even if the specific workload isn’t profiled). The reason is that it’s using the profiles to make decisions in lieu of heuristics which should be a win even for non profiled workloads because heuristics are essentially just general case profiles (ie tuned to a bunch of OSS software out there). I’m unaware of any research showing PGO being worse than not doing it even if your profile isn’t the workload (you’d probably have to try to specially build such a situation and unlikely to come up in practice). Have you actually seen otherwise?
- Filligree 4y agoThroughput isn't everything, and improving OPS at the expensive of tail latency can be a problem. Depends on your specific workload, but it isn't something I'd enable by default.
- summerlight 4y agoPGO will still likely improve general performance even with biased workloads because in many cases we want compilers to focus on optimizing happy paths, but this is not always well executed even when it's pretty trivial for human eyes.
- unnouinceput 4y ago[flagged]
- xeonmc 4y agoOh, I just assumed that the article was written by a French and shrugged.
- mgaunard 4y ago[flagged]
- arunc 4y ago> On 11/07/2022 Jakub Beránek announced Not to be snobby, but I wish everyone used a standard date format.
- gompertz 4y agohttps://www.iso.org/iso-8601-date-and-time-format.html https://www.iso.org/iso-8601-date-and-time-format.html is the world you are dreaming of...