Skip to content

Commit

Permalink
Entirely replace smallvec with tinyvec
Browse files Browse the repository at this point in the history
  • Loading branch information
kcaffrey committed Dec 26, 2023
1 parent bb6b4c4 commit e62f0bc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
10 changes: 9 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ pico-args = "0.5.0"
tinyjson = "2.5.1"
# Solution dependencies
enum-ordinalize = "4.2.1"
smallvec = "1.11.2"
itertools = "0.12.0"
rayon = "1.8.0"
num-integer = "0.1"
thiserror = "1.0.50"
either = "1.9.0"
tinyvec = "1.6.0"
tinyvec = { version = "1.6.0", features = ["alloc"] }
fxhash = "0.2.1"
rand = "0.8.5"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
| Day | Part 1 | Part 2 |
| :---: | :---: | :---: |
| [Day 1](./src/bin/01.rs) | `34.8µs` | `38.2µs` |
| [Day 2](./src/bin/02.rs) | `42.2µs` | `41.9µs` |
| [Day 2](./src/bin/02.rs) | `41.8µs` | `41.9µs` |
| [Day 3](./src/bin/03.rs) | `83.8µs` | `98.8µs` |
| [Day 4](./src/bin/04.rs) | `49.3µs` | `50.1µs` |
| [Day 5](./src/bin/05.rs) | `20.5µs` | `24.4µs` |
Expand All @@ -62,7 +62,7 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
| [Day 19](./src/bin/19.rs) | `83.9µs` | `90.9µs` |
| [Day 20](./src/bin/20.rs) | `323.9µs` | `1.2ms` |
| [Day 21](./src/bin/21.rs) | `64.1µs` | `494.7µs` |
| [Day 22](./src/bin/22.rs) | `78.3µs` | `194.8µs` |
| [Day 22](./src/bin/22.rs) | `82.6µs` | `196.7µs` |
| [Day 23](./src/bin/23.rs) | `330.4µs` | `13.3ms` |
| [Day 24](./src/bin/24.rs) | `123.6µs` | `18.3µs` |
| [Day 25](./src/bin/25.rs) | `256.4µs` | `-` |
Expand Down
6 changes: 3 additions & 3 deletions src/bin/02.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use smallvec::SmallVec;
use tinyvec::TinyVec;

advent_of_code::solution!(2);

Expand Down Expand Up @@ -37,7 +37,7 @@ pub fn part_two(input: &str) -> Option<u32> {
)
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Default, Debug, Eq, PartialEq, PartialOrd)]
struct Colors {
red: u32,
green: u32,
Expand All @@ -47,7 +47,7 @@ struct Colors {
#[derive(Clone, Debug, Eq, PartialEq)]
struct Game {
id: u32,
reveals: SmallVec<[Colors; 10]>,
reveals: TinyVec<[Colors; 10]>,
}

impl Game {
Expand Down
6 changes: 3 additions & 3 deletions src/bin/22.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use smallvec::SmallVec;
use tinyvec::TinyVec;

advent_of_code::solution!(22);

Expand Down Expand Up @@ -141,8 +141,8 @@ struct Brick {
#[derive(Debug, Clone)]
struct Tower {
bricks: Vec<Brick>,
supports: Vec<SmallVec<[usize; 4]>>,
supported: Vec<SmallVec<[usize; 4]>>,
supports: Vec<TinyVec<[usize; 4]>>,
supported: Vec<TinyVec<[usize; 4]>>,
top_view: Grid2<(usize, u16)>,
}

Expand Down

0 comments on commit e62f0bc

Please sign in to comment.