The first thing the `encode` function does is truncate the `dst` buffer,
so this should never be necessary inside the code being benchmarked for
testing encoders.
Benchmarking random values was more general than sequential since it
takes an arbitrary function to create the decoded values; express
sequential in terms of random and change the name of random to be
general benchmarking of encoding.
For reference, the [2018 edition guide][guide] talks about some of the
big differences.
The two that are applied here are:
1. `extern crate` is basically not needed at all anymore; you can do
`use cratename` instead. This makes importing things more uniform
between your own crate and other crates.
1. Rust does a reasonable amount of [*lifetime elision*][elision] so
we don't have to type `'a` in as many places. However, one that
ended up tripping up people is when a generic lifetime was part of
a type. The compiler cared about this lifetime, but since it
wasn't visible, people would forget it's there, then try to use it
as if it wasn't constrained by the lifetime.
A good example is the `Chars` iterator. It references the original
`&str` and cannot live longer than the string. With the original
way this was being passed (`&mut Chars`) it was visually evident
that there was *some* lifetime, thanks to seeing the `&`, but it
wasn't obvious that there's *another* lifetime — the string.
With the addition of the *anonymous lifetime* (`'_`), it's now
encouraged to use that when a type has a lifetime parameter that
isn't relevant to prevent confusing mistakes that lead to compiler
errors.
There are probably a few more things enabled by the lint as well. I
forget the exact reason that these are not yet enabled by default,
though.
[guide]: https://doc.rust-lang.org/edition-guide/rust-2018/index.html
[elision]: https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html#lifetime-elision
By default, the RocksDB C library is compiled using the number of
cores on the machine. In CircleCI, this is 36 cores. Unfortunately,
that appears to completely blow out the memory usage, causing the C
compiler invocations to be killed.
This commit reduces the *entire* parallelism of the build to avoid
that.
This configures a circleci pipeline that runs fmt, lint, test, and build operations.
I changed the fmt command to --check since --overwrite is no longer supported.
The pipeline will always run on nightly builds of rust.
This commit adds benchmarks for the float encoder and decoder. The
following scenarios are benchmarked:
- sequential values;
- random values;
- real CPU values (from Telegraf output).
Each scenario is benchmarked with a variety of block sizes.