Skip to content
Permalink
Browse files

add an allocation counter test for scheduling tasks (#1315)

* add an allocation counter test for scheduling tasks

Motivation:

Scheduling tasks is important so we should have an allocation counter
test.

Modifications:

add one

Result:

more alloc counter tests

* Update test_schedule_10000_tasks.swift

* Update docker-compose.1804.50.yaml

* Update docker-compose.1604.51.yaml
  • Loading branch information
weissi committed Dec 18, 2019
1 parent 4dd5586 commit 7314c597338958e7be49de32e9064ccc1a256229
@@ -0,0 +1,35 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Dispatch
import NIO

func run(identifier: String) {
let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let loop = group.next()
let dg = DispatchGroup()

measure(identifier: identifier) {
loop.execute {
for _ in 0..<10_000 {
dg.enter()
loop.scheduleTask(in: .nanoseconds(0)) { dg.leave() }
}
}
dg.wait()
return 10_000
}

try! group.syncShutdownGracefully()
}
@@ -32,6 +32,7 @@ services:
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer_with_space=4010
- MAX_ALLOCS_ALLOWED_decode_1000_ws_frames=1000
- MAX_ALLOCS_ALLOWED_modifying_byte_buffer_view=6010
- MAX_ALLOCS_ALLOWED_schedule_10000_tasks=90050
- SANITIZER_ARG=--sanitize=thread

performance-test:
@@ -32,6 +32,7 @@ services:
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer_with_space=4010
- MAX_ALLOCS_ALLOWED_decode_1000_ws_frames=1000
- MAX_ALLOCS_ALLOWED_modifying_byte_buffer_view=6010
- MAX_ALLOCS_ALLOWED_schedule_10000_tasks=90050

performance-test:
image: swift-nio:18.04-5.0

0 comments on commit 7314c59

Please sign in to comment.
You can’t perform that action at this time.