Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further distance transform speedups. #30

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

khoover
Copy link
Contributor

@khoover khoover commented Oct 5, 2024

Before:

running 2 tests
test benches::bench_chebyshev_distance_transform ... bench:       9,446 ns/iter (+/- 556)
test benches::bench_manhattan_distance_transform ... bench:       5,658 ns/iter (+/- 141)

After:

running 2 tests
test benches::bench_chebyshev_distance_transform ... bench:       7,340 ns/iter (+/- 267)
test benches::bench_manhattan_distance_transform ... bench:       4,401 ns/iter (+/- 143)

Replaces zipping the RoomXY iterators with a simple map for the column shift, and makes extensive use of checked arithmetic to avoid unnecessary writes.

Before:
```
running 2 tests
test benches::bench_chebyshev_distance_transform ... bench:       9,446 ns/iter (+/- 556)
test benches::bench_manhattan_distance_transform ... bench:       5,658 ns/iter (+/- 141)
```

After:
```
running 2 tests
test benches::bench_chebyshev_distance_transform ... bench:       7,340 ns/iter (+/- 267)
test benches::bench_manhattan_distance_transform ... bench:       4,401 ns/iter (+/- 143)
```
@InfinityDevTech
Copy link

You psycho.

@shanemadden shanemadden merged commit 214aec5 into rustyscreeps:main Oct 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants