- Hands-On Server-Side Web Development with Swift
- Angus Yeung
- 155字
- 2021-06-10 19:00:09
Performance
Since Swift is a compiled language, server-side frameworks written in pure Swift are not necessarily slower than frameworks written in other native programming languages. However, different Swift server-side frameworks may adopt different low-level software stacks or handle events differently.
A collection of benchmarks for popular web frameworks, including both Swift and non-Swift implementations, are documented here: https://medium.com/@codevapor/vapor-3-0-0-released-8356fa619a5d. As we can see, Swift frameworks perform better than most of the web frameworks that are written in interpreted languages such as JavaScript and Python. The benchmarks were based on processing plain text and demonstrated how fast Swift can process HTTP headers. All three Swift server-side frameworks, Vapor, Perfect, and Kitura, are comparable in their performance of plain text processing.
If you are interested in evaluating different aspects of a web framework, for example, the performance for handling routing and parsing path parameters, you can use the Benchmark tool (https://github.com/vapor/benchmarks) to generate specific benchmarks for comparison.