Commit Graph
6 Commits
Author SHA1 Message Date
Maxim ZaksandCory Benfield c776f6e539 Improving performance of base64 encoding by about 10% (#1862)
* Improving performance of base64 encoding by about 10%

* revert alphabet change and use String(customUnsafeUninitializedCapacity:initializingUTF8With:)

* Add performance test for random request key generation

* use reduce

* fix indentation

* add `@inlinable` on custom unsefe inializer for older Swift version

* fix issues mentioned in review

Co-authored-by: Cory Benfield <lukasa@apple.com>
2021-06-07 11:12:06 +01:00
David Nadoba 465f87dd7c Random WebSocket Request Key (#1855)
* add randomRequestKey method

* fix some typos

* fix compilation on 5.0

* run generate_linux_tests.rb

* add test with default random number generator

* @inlineable

* base64Encoding @inlineable
2021-05-24 16:02:16 +01:00
Fabian Fett 653492753c Faster Base64 Encoding for NIOWebsocket connections (#1328)
Motivation:

In performance tests was shown that the current base 64 encoding function doesn’t perform very well.

https://github.com/apple/swift-nio/issues/1322

Modifications:

This commit replaces the current Base64 implementation with a more performant one (by using UInt8 bytes instead of Unicode.Scalars).

Result:

The API will stay the same. Base64 encoding is just faster.
2019-12-24 12:41:43 +00:00
Johannes Weiss 0ac7e2266b remove extension public/internal modifiers (#822)
Motivation:

public/internal modifiers for `extension`s are confusing as a
`func foo` is public if within a `public extension`.

Modifications:

remove all `internal` (redundant) and `public` (dangerous) modifiers for
`extensions`.

Result:

- code easier to read
- code much easier to review in a small diff
2019-02-14 13:25:30 +00:00
Johannes Weiss 9b78557aff kick off NIO2 (#678)
Motivation:

NIO2 development starts now.

Modifications:

Made NIO Swift 5-only for everything else see docs/public-api-changes-NIO1-to-NIO2.md

Result:

NIO2 development can start.
2018-12-07 21:15:34 +00:00
Cory Benfield b542775605 Add initial websocket codec. (#109)
Motivation:

Websockets is a major protocol in use on the web today, and is
particularly valuable in applications that use asynchronous I/O
as it allows servers to keep connections open for long periods of
time for fully-duplex communication.

Users of NIO should be able to build websocket clients and servers
without too much difficulty.

Modifications:

Provided a WebsocketFrameEncoder and Decoder that can serialize and
deserialize Websocket frames.

Result:

Easier use of websockets.
2018-03-13 17:24:54 +01:00