[ i quite like my version of O’Neill’s PCG RNG with Lemire’s nearly-divisionless unbiased range reduction, which the benchmark needed to avoid poor performance from the kernel RNG on a VM (pcg64.h) github.com/fanf2/nsd/blob/fa… (pcg64.c) github.com/fanf2/nsd/blob/fa… ]
1
hmm i have a naming quandry two types for DNS names: non-allocating, borrowing a slice from the wire allocating, owning a copy of the name the owned version is immutable, so the Path / PathBuf idiom doesn’t work
2
1
maybe WireName vs OwnName will do
1
i think this is a satisfactory solution to my naming quandry: DnsName (trait, implemented by …) HeapName (owned and allocated) MessageName (compressed, 16 bit label positions) WireName (uncompressed, 8 bit label positions)
1
distinct MessageName and WireName types could be over-engineering, but WireName might be usefully faster for parsing a QNAME, and usefully stricter for RDATA fields that must not be compressed
1
ooh this is helpful, it tells me what my CPU is $ rustc --print target-cpus Available CPUs for this target: native - Select the CPU of the current host (currently skylake). (etc)
1
did i really just write 50 lines of rust that passed the compiler first time?!1?!/!?!eleventy?! with double indirections because peekable() is annoying?!
1
4
i’m staring at my dns name code and thinking that i have left case folding too late because it is making comparisons too complicated
2
1
i’m trying to make sure that my code doesn’t unnecessarily copy dns names e.g. let thing: BigStruct = fill_bigstruct_from(&data); i would like the filling to write directly to the caller’s stack frame and I’m looking at github.com/rust-lang/rust/is… so i need to do NRVO manually?
2
Replying to @fanf
I'd start with doing the cleanest looking code, and then only worry if the optimiser isn't doing what you want.

May 17, 2021 · 12:50 PM UTC