Skip to content

Commit

Permalink
perf: Use enum_dispatch over dynamic dispatch (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky authored Nov 21, 2024
1 parent a4f9db1 commit 9eeb0e8
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 630 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ strum_macros = "0.26"
cfg-if = "1.0.0"
libflate = "2.0.0"
form_urlencoded = "1.2.1"
enum_dispatch = "0.3.13"
gxhash = "3.4.1"

[dependencies.hyper-util]
Expand Down
9 changes: 1 addition & 8 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ version:
@echo $(package_version)

# Run all tests
test: ensure-build-image test-quilkin test-examples test-docs
test: ensure-build-image test-quilkin test-docs

# In CI with split jobs that both fetch they will fail if run in parallel since
# cargo will be fighting with itself for some the same host directory that is
Expand All @@ -103,13 +103,6 @@ test-quilkin: ensure-build-image
--network=host \
-e RUST_BACKTRACE=1 --entrypoint=cargo $(BUILD_IMAGE_TAG) test -p quilkin -p qt

# Run tests against the examples
test-examples: ensure-build-image
docker run --rm $(common_rust_args) -w /workspace/examples/quilkin-filter-example \
--entrypoint=cargo $(BUILD_IMAGE_TAG) clippy --tests -- -D warnings
docker run --rm $(common_rust_args) -w /workspace/examples/quilkin-filter-example \
--entrypoint=cargo $(BUILD_IMAGE_TAG) fmt -- --check

# Run tests against documentation
test-docs: ensure-build-image
test-docs: GITHUB_REF_NAME ?= main
Expand Down
5 changes: 0 additions & 5 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ steps:
id: test-quilkin
waitFor:
- fetch-quilkin
- name: us-docker.pkg.dev/$PROJECT_ID/ci/make-docker
dir: ./build
args:
- test-examples
id: test-examples
- name: us-docker.pkg.dev/$PROJECT_ID/ci/make-docker
dir: ./build
args:
Expand Down
3 changes: 1 addition & 2 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
- [Pass](./services/proxy/filters/pass.md)
- [Timestamp](./services/proxy/filters/timestamp.md)
- [Token Router](./services/proxy/filters/token_router.md)
- [Writing Custom Filters](./services/proxy/filters/writing_custom_filters.md)
- [Control Message Protocol](./services/proxy/qcmp.md)
- [Metrics](./services/proxy/metrics.md)

Expand Down Expand Up @@ -55,4 +54,4 @@

# Third Party

- [Videos and Presentations](./third-party/presentations.md)
- [Videos and Presentations](./third-party/presentations.md)
3 changes: 1 addition & 2 deletions docs/src/services/proxy/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ As an example, say we would like to perform the following steps in our processin
* Do not forward (drop) the packet if its compressed length is over 512 bytes.

We would create a filter corresponding to each step either by leveraging any [existing filters](#built-in-filters)
that do what we want or [writing one ourselves](./filters/writing_custom_filters.md) and connect them to form the
following filter chain:
that do what we want or and connect them to form the following filter chain:

```bash
append | compress | drop
Expand Down
277 changes: 0 additions & 277 deletions docs/src/services/proxy/filters/writing_custom_filters.md

This file was deleted.

Loading

0 comments on commit 9eeb0e8

Please sign in to comment.