mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Motivation: The WebSocketFrameEncoder naively allocated a new block to write the frame header into every time it wrote. This is excessive: in many cases it would be able to re-use the same buffer as last time. Modifications: - Attempt to re-use the buffer we used for the last header. Result: Fewer allocations in some applications.
40 lines
1.4 KiB
Swift
40 lines
1.4 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// WebSocketFrameEncoderTest+XCTest.swift
|
|
//
|
|
import XCTest
|
|
|
|
///
|
|
/// NOTE: This file was generated by generate_linux_tests.rb
|
|
///
|
|
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
|
///
|
|
|
|
extension WebSocketFrameEncoderTest {
|
|
|
|
static var allTests : [(String, (WebSocketFrameEncoderTest) -> () throws -> Void)] {
|
|
return [
|
|
("testBasicFrameEncoding", testBasicFrameEncoding),
|
|
("test16BitFrameLength", test16BitFrameLength),
|
|
("test64BitFrameLength", test64BitFrameLength),
|
|
("testEncodesEachReservedBitProperly", testEncodesEachReservedBitProperly),
|
|
("testEncodesExtensionDataCorrectly", testEncodesExtensionDataCorrectly),
|
|
("testMasksDataCorrectly", testMasksDataCorrectly),
|
|
("testFrameEncoderReusesHeaderBufferWherePossible", testFrameEncoderReusesHeaderBufferWherePossible),
|
|
]
|
|
}
|
|
}
|
|
|