What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.
In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.
Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th
extern crate smallvec; | |
use smallvec::SmallVec; | |
struct Printer(usize); | |
impl Drop for Printer { | |
fn drop(&mut self) { | |
println!("Dropping {}", self.0); | |
} |
In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.
Here's one way to set it up:
- Install Node.js
- Run
npm init -y
in your project folder (don't skip this step!) - Run
npm install terser
Now, to minify a file called like_button.js
, run in the terminal:
BISECT: running pass (1) Simplify the CFG on function (_ZN38_$LT$core..option..Option$LT$T$GT$$GT$5ok_or17h4281056672a8d3efE) | |
BISECT: running pass (2) SROA on function (_ZN38_$LT$core..option..Option$LT$T$GT$$GT$5ok_or17h4281056672a8d3efE) | |
BISECT: running pass (3) Early CSE on function (_ZN38_$LT$core..option..Option$LT$T$GT$$GT$5ok_or17h4281056672a8d3efE) | |
BISECT: running pass (4) Simplify the CFG on function (_ZN38_$LT$core..option..Option$LT$T$GT$$GT$6unwrap17hb5bd41d1ab85ed34E) | |
BISECT: running pass (5) SROA on function (_ZN38_$LT$core..option..Option$LT$T$GT$$GT$6unwrap17hb5bd41d1ab85ed34E) | |
BISECT: running pass (6) Early CSE on function (_ZN38_$LT$core..option..Option$LT$T$GT$$GT$6unwrap17hb5bd41d1ab85ed34E) | |
BISECT: running pass (7) Simplify the CFG on function (_ZN3std2rt10lang_start17h87222d106ff7b973E) | |
BISECT: running pass (8) SROA on function (_ZN3std2rt10lang_start17h87222d106ff7b973E) | |
BISECT: running pass (9) Early CSE on function (_ZN3std2rt10lang_start17h87222d106ff7b973E) | |
BISECT: running pass (10) |
Hello, Rust community!
My name is Hadrien and I am a software performance engineer in a particle physics lab. My daily job is to figure out ways to make scientific software use hardware more efficiently without sacrificing its correctness, primarily by adapting old-ish codebases to the changes that occured in the software and computing landscape since the days where they were designed:
- CPU clock rates and instruction-level parallelism stopped going up, so optimizing code is now more important.
- Multi-core CPUs went from an exotic niche to a cheap commodity, so parallelism is not optional anymore.
- Core counts grow faster than RAM prices go down, so multi-processing is not enough anymore.
- SIMD vectors become wider and wider, so vectorization is not a gimmick anymore.
I recently ran into a classic case of "our code is using way more memory than it should". So I took my first dive into memory profiling Rust code. I read several posts about this, including the following
$ perf stat -d ./omp-stream | |
BabelStream | |
Version: 3.4 | |
Implementation: OpenMP | |
Running kernels 100 times | |
Precision: double | |
Array size: 268.4 MB (=0.3 GB) | |
Total size: 805.3 MB (=0.8 GB) | |
Function MBytes/sec Min (sec) Max Average | |
Copy 108865.244 0.00493 0.05374 0.00834 |
Video Demo of Embedded Rust on STM32 Blue Pill with Quectel BC95-G NB-IoT module, Apache Mynewt, StarHub NB-IoT network, thethings.io:
https://youtu.be/MgK72dqwDuM
Rust Source Code:
https://github.com/lupyuen/stm32bluepill-mynewt-sensor/tree/rust-nbiot/rust
Repository including Apache Mynewt and C code:
https://github.com/lupyuen/stm32bluepill-mynewt-sensor/tree/rust-nbiot
This is my third roadmap post... you can find the first two here:
This year, I am quite divided due to a bunch of competing desires:
- I still want all of the things that I wanted last year. In particular, it would be great if OS developement could finally be done on stable rust. Things like inline asm are blocking this.