Compare commits
3 Commits
c6abd47ef0
...
5cb9c3d202
Author | SHA1 | Date | |
---|---|---|---|
5cb9c3d202 | |||
27040b66ee | |||
0d740621c6 |
@ -1,2 +1,5 @@
|
|||||||
[alias]
|
[alias]
|
||||||
xtask = "run --package xtask --"
|
xtask = "run --package xtask --"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
rustflags = "-Ctarget-cpu=core-avx2"
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
FROM rust:1.80-alpine3.20 as build
|
FROM rust:1.81-bookworm as build
|
||||||
|
|
||||||
COPY battlesnake/ /usr/app
|
COPY battlesnake/ /usr/app
|
||||||
WORKDIR /usr/app
|
WORKDIR /usr/app
|
||||||
|
|
||||||
RUN apk add --no-cache musl-dev=1.2.5-r0
|
|
||||||
RUN cargo install --path .
|
RUN cargo install --path .
|
||||||
|
|
||||||
FROM alpine:3.20
|
FROM debian:bookworm
|
||||||
COPY --from=build /usr/local/cargo/bin/battlesnake /bin/battlesnake
|
COPY --from=build /usr/local/cargo/bin/battlesnake /bin/battlesnake
|
||||||
|
|
||||||
CMD ["battlesnake"]
|
CMD ["battlesnake"]
|
||||||
|
2
battlesnake/.cargo/config.toml
Normal file
2
battlesnake/.cargo/config.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[build]
|
||||||
|
rustflags = "-Ctarget-cpu=core-avx2"
|
@ -159,13 +159,13 @@ fn regression() -> Result<(), DynError> {
|
|||||||
let (won, games) = res?;
|
let (won, games) = res?;
|
||||||
println!(
|
println!(
|
||||||
"\nThe local snake has won {won}/{games} games ({}%)",
|
"\nThe local snake has won {won}/{games} games ({}%)",
|
||||||
won * 100 / games
|
(won + games / 200) * 100 / games
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_regression() -> Result<(usize, usize), DynError> {
|
fn try_regression() -> Result<(usize, usize), DynError> {
|
||||||
const GAMES: usize = 100;
|
const GAMES: usize = 1000;
|
||||||
// limit the parallelism
|
// limit the parallelism
|
||||||
rayon::ThreadPoolBuilder::new()
|
rayon::ThreadPoolBuilder::new()
|
||||||
.num_threads(std::thread::available_parallelism()?.get() / 3)
|
.num_threads(std::thread::available_parallelism()?.get() / 3)
|
||||||
@ -184,6 +184,8 @@ fn try_regression() -> Result<(usize, usize), DynError> {
|
|||||||
"11",
|
"11",
|
||||||
"-H",
|
"-H",
|
||||||
"11",
|
"11",
|
||||||
|
"--timeout",
|
||||||
|
"50",
|
||||||
"--name",
|
"--name",
|
||||||
"local",
|
"local",
|
||||||
"--url",
|
"--url",
|
||||||
@ -246,6 +248,10 @@ fn run_production(port: u16) -> Result<Child, DynError> {
|
|||||||
let mut snake = Command::new("docker")
|
let mut snake = Command::new("docker")
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
|
"--name",
|
||||||
|
"battlesnake-regression",
|
||||||
|
"--init",
|
||||||
|
"--replace",
|
||||||
"--env",
|
"--env",
|
||||||
"RUST_LOG=error",
|
"RUST_LOG=error",
|
||||||
"--env",
|
"--env",
|
||||||
|
Loading…
Reference in New Issue
Block a user