From ac26c7298ddcf06190c13b58e7f0ced0f71865df Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Fri, 1 Mar 2019 18:53:25 +0000 Subject: [PATCH] slight improvements to the allocation tests (#859) Motivation: The allocation tests were needlessly running the resolver within the allocation counted loop. Modifications: - bump to Swift version 5.0 - take the resolving out of the allocation counting loop Result: more accurate results --- .../test_01_resources/template/AtomicCounter/Package.swift | 2 +- .../test_01_resources/template/HookedFunctions/Package.swift | 2 +- .../test_01_resources/template/Package.swift | 2 +- .../template/Sources/SwiftBootstrap/SwiftMain.swift | 4 +++- docker/docker-compose.1804.50.yaml | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/IntegrationTests/tests_04_performance/test_01_resources/template/AtomicCounter/Package.swift b/IntegrationTests/tests_04_performance/test_01_resources/template/AtomicCounter/Package.swift index 0ce998df..520c45ed 100644 --- a/IntegrationTests/tests_04_performance/test_01_resources/template/AtomicCounter/Package.swift +++ b/IntegrationTests/tests_04_performance/test_01_resources/template/AtomicCounter/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.0 // The swift-tools-version declares the minimum version of Swift required to build this package. //===----------------------------------------------------------------------===// // diff --git a/IntegrationTests/tests_04_performance/test_01_resources/template/HookedFunctions/Package.swift b/IntegrationTests/tests_04_performance/test_01_resources/template/HookedFunctions/Package.swift index cbfe2af0..96d0cec2 100644 --- a/IntegrationTests/tests_04_performance/test_01_resources/template/HookedFunctions/Package.swift +++ b/IntegrationTests/tests_04_performance/test_01_resources/template/HookedFunctions/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.0 // The swift-tools-version declares the minimum version of Swift required to build this package. //===----------------------------------------------------------------------===// // diff --git a/IntegrationTests/tests_04_performance/test_01_resources/template/Package.swift b/IntegrationTests/tests_04_performance/test_01_resources/template/Package.swift index 94b3f4c7..a761ac9e 100644 --- a/IntegrationTests/tests_04_performance/test_01_resources/template/Package.swift +++ b/IntegrationTests/tests_04_performance/test_01_resources/template/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/IntegrationTests/tests_04_performance/test_01_resources/template/Sources/SwiftBootstrap/SwiftMain.swift b/IntegrationTests/tests_04_performance/test_01_resources/template/Sources/SwiftBootstrap/SwiftMain.swift index 56d863d8..186c43b8 100644 --- a/IntegrationTests/tests_04_performance/test_01_resources/template/Sources/SwiftBootstrap/SwiftMain.swift +++ b/IntegrationTests/tests_04_performance/test_01_resources/template/Sources/SwiftBootstrap/SwiftMain.swift @@ -12,6 +12,8 @@ // //===----------------------------------------------------------------------===// +let localhostPickPort = try! SocketAddress.makeAddressResolvingHost("127.0.0.1", port: 0) + import NIO import NIOHTTP1 import Foundation @@ -243,7 +245,7 @@ public func swiftMain() -> Int { withErrorHandling: false).flatMap { channel.pipeline.addHandler(SimpleHTTPServer()) } - }.bind(host: "127.0.0.1", port: 0).wait() + }.bind(to: localhostPickPort).wait() defer { try! serverChannel.close().wait() diff --git a/docker/docker-compose.1804.50.yaml b/docker/docker-compose.1804.50.yaml index 2cd7c9a2..4f332093 100644 --- a/docker/docker-compose.1804.50.yaml +++ b/docker/docker-compose.1804.50.yaml @@ -20,7 +20,7 @@ services: image: swift-nio:18.04-5.0 environment: - MAX_ALLOCS_ALLOWED_1000_reqs_1_conn=36750 - - MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=692050 + - MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=685050 - MAX_ALLOCS_ALLOWED_ping_pong_1000_reqs_1_conn=4600 - MAX_ALLOCS_ALLOWED_bytebuffer_lots_of_rw=2100 - MAX_ALLOCS_ALLOWED_future_lots_of_callbacks=99100 @@ -30,7 +30,7 @@ services: command: /bin/bash -cl "swift test -Xswiftc -warnings-as-errors -Xswiftc -DNIO_CI_BUILD && ./scripts/integration_tests.sh" environment: - MAX_ALLOCS_ALLOWED_1000_reqs_1_conn=36750 - - MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=692050 + - MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=685050 - MAX_ALLOCS_ALLOWED_ping_pong_1000_reqs_1_conn=4600 - MAX_ALLOCS_ALLOWED_bytebuffer_lots_of_rw=2100 - MAX_ALLOCS_ALLOWED_future_lots_of_callbacks=99100