mirror of
https://github.com/apple/swift-nio
synced 2026-11-28 05:14:23 +00:00
### Motivation: In my previous PR https://github.com/apple/swift-nio/pull/2009, I added baseline performance and allocation tests around `scheduleTask` and `execute`. After analysing, the various allocations that happen when scheduling a task there were only a few that could be optimized away potentially. ### Modifications: This PR converts the `ScheduledTask` class to a struct which will reduce the number of allocations for scheduling tasks by 1. The only thing that needs to be worked around when converting to a struct is giving it an identity so that we can implement `Equatable` conformance properly. I explored two options. First, using an `ObjectIdentifier` passed to the init. Second, using an atomic counter per EventLoop. I went with the latter since the former requires an additional allocation in the case of calling `execute` ### Result: `scheduleTask` and `execute` require one less allocation
72 lines
2.9 KiB
YAML
72 lines
2.9 KiB
YAML
version: "3"
|
|
|
|
services:
|
|
|
|
runtime-setup:
|
|
image: swift-nio:20.04-main
|
|
build:
|
|
args:
|
|
base_image: "swiftlang/swift:nightly-main-focal"
|
|
ubuntu_version: "focal"
|
|
|
|
unit-tests:
|
|
image: swift-nio:20.04-main
|
|
|
|
integration-tests:
|
|
image: swift-nio:20.04-main
|
|
|
|
test:
|
|
image: swift-nio:20.04-main
|
|
environment:
|
|
- MAX_ALLOCS_ALLOWED_1000_addHandlers=46050
|
|
- MAX_ALLOCS_ALLOWED_1000_addHandlers_sync=39050
|
|
- MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlercontext=9050
|
|
- MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlername=9050
|
|
- MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlertype=9050
|
|
- MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet=24050
|
|
- MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet_sync=0
|
|
- MAX_ALLOCS_ALLOWED_1000_getHandlers=9050
|
|
- MAX_ALLOCS_ALLOWED_1000_getHandlers_sync=37
|
|
- MAX_ALLOCS_ALLOWED_1000_reqs_1_conn=30450
|
|
- MAX_ALLOCS_ALLOWED_1000_tcpbootstraps=4050
|
|
- MAX_ALLOCS_ALLOWED_1000_tcpconnections=161050
|
|
- MAX_ALLOCS_ALLOWED_1000_udp_reqs=12050
|
|
- MAX_ALLOCS_ALLOWED_1000_udpbootstraps=2050
|
|
- MAX_ALLOCS_ALLOWED_1000_udpconnections=87050
|
|
- MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=428050
|
|
- MAX_ALLOCS_ALLOWED_bytebuffer_lots_of_rw=2050
|
|
- MAX_ALLOCS_ALLOWED_creating_10000_headers=0
|
|
- MAX_ALLOCS_ALLOWED_decode_1000_ws_frames=2050
|
|
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_holding_buffer=3
|
|
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_holding_buffer_with_space=3
|
|
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer=3050
|
|
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer_with_space=3050
|
|
- MAX_ALLOCS_ALLOWED_future_erase_result=4050
|
|
- MAX_ALLOCS_ALLOWED_future_lots_of_callbacks=59050
|
|
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form=700050
|
|
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form_trimming_whitespace=700050
|
|
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form_trimming_whitespace_from_long_string=700050
|
|
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form_trimming_whitespace_from_short_string=700050
|
|
- MAX_ALLOCS_ALLOWED_modifying_1000_circular_buffer_elements=0
|
|
- MAX_ALLOCS_ALLOWED_modifying_byte_buffer_view=2050
|
|
- MAX_ALLOCS_ALLOWED_ping_pong_1000_reqs_1_conn=4400
|
|
- MAX_ALLOCS_ALLOWED_read_10000_chunks_from_file=150050
|
|
- MAX_ALLOCS_ALLOWED_schedule_10000_tasks=80150
|
|
- MAX_ALLOCS_ALLOWED_schedule_and_run_10000_tasks=90050
|
|
- MAX_ALLOCS_ALLOWED_scheduling_10000_executions=10150
|
|
- MAX_ALLOCS_ALLOWED_udp_1000_reqs_1_conn=12200
|
|
- MAX_ALLOCS_ALLOWED_udp_1_reqs_1000_conn=177050
|
|
# - SANITIZER_ARG=--sanitize=thread # TSan broken still
|
|
|
|
performance-test:
|
|
image: swift-nio:20.04-main
|
|
|
|
shell:
|
|
image: swift-nio:20.04-main
|
|
|
|
echo:
|
|
image: swift-nio:20.04-main
|
|
|
|
http:
|
|
image: swift-nio:20.04-main
|