Skip to content

Commit 0b1f8ab

Browse files
tried adding 3 more libraries to be tested against
1 parent 8cc8280 commit 0b1f8ab

File tree

7 files changed

+114
-5
lines changed

7 files changed

+114
-5
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ Package.resolved
1010
__BenchmarkBoilerplate.d
1111
__BenchmarkBoilerplate.o
1212
__BenchmarkBoilerplate.swiftdeps
13-
__BenchmarkBoilerplate.swiftdeps~
13+
__BenchmarkBoilerplate.swiftdeps~
14+
Tag.d
15+
Tag.o
16+
Tag.swiftdeps
17+
Tags.d

Benchmarks/Benchmarks/Benchmarks/Benchmarks.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import TestElementary
1212
import TestPlot
1313
import TestSwiftHTMLKit
1414
import TestSwiftHTMLPF
15+
import TestSwim
16+
import TestToucan
1517
import TestVaporHTMLKit
18+
import TestVaux
1619

1720
let benchmarks = {
1821
Benchmark.defaultConfiguration = .init(metrics: .all)
@@ -22,6 +25,7 @@ let benchmarks = {
2225
"Plot" : PlotTests(),
2326
"SwiftHTMLKit" : SwiftHTMLKitTests(),
2427
"SwiftHTMLPF" : SwiftHTMLPFTests(),
28+
//"Swim" : SwimTests(),
2529
"VaporHTMLKit" : VaporHTMLKitTests()
2630
]
2731

Benchmarks/Benchmarks/Swim/Swim.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// Swim.swift
3+
//
4+
//
5+
// Created by Evan Anderson on 10/6/24.
6+
//
7+
8+
/*
9+
import Utilities
10+
import Swim
11+
import HTML
12+
13+
package struct SwimTests : HTMLGenerator {
14+
package init() {}
15+
16+
package func simpleHTML() -> String {
17+
html {
18+
body {
19+
h1 {
20+
"Swift HTML Benchmarks"
21+
}
22+
}
23+
}
24+
}
25+
package func optimalHTML() -> String {
26+
simpleHTML()
27+
}
28+
}*/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//
2+
// Toucan.swift
3+
//
4+
//
5+
// Created by Evan Anderson on 10/6/24.
6+
//

Benchmarks/Benchmarks/Vaux/Vaux.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// Vaux.swift
3+
//
4+
//
5+
// Created by Evan Anderson on 10/6/24.
6+
//
7+
8+
import Utilities
9+
import Vaux
10+
import Foundation
11+
12+
/*
13+
package struct VauxTests : HTMLGenerator {
14+
15+
let vaux:Vaux
16+
package init() {
17+
vaux = Vaux()
18+
}
19+
20+
package func simpleHTML() -> String {
21+
var stream:HTMLOutputStream = HTMLOutputStream(FileHandle.standardOutput, nil)
22+
let content = html {
23+
body {
24+
heading(.h1) {
25+
"Swift HTML Benchmarks"
26+
}
27+
}
28+
}
29+
stream.render(content)
30+
let textoutput:TextOutputStream = stream.output
31+
return ""
32+
}
33+
34+
package func optimalHTML() -> String {
35+
simpleHTML()
36+
}
37+
}*/

Benchmarks/Package.swift

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ let package = Package(
1414
.package(url: "https://github.com/sliemeobn/elementary", from: "0.3.4"),
1515
.package(url: "https://github.com/vapor-community/HTMLKit", from: "2.8.1"),
1616
.package(url: "https://github.com/pointfreeco/swift-html", from: "0.4.1"),
17-
//.package(name: "BBHTML", url: "https://github.com/BinaryBirds/swift-html", from: "1.7.0")
18-
.package(url: "https://github.com/JohnSundell/Plot", from: "0.14.0")
17+
//.package(name: "BBHTML", url: "https://github.com/BinaryBirds/swift-html", from: "1.7.0") // conflicting package name
18+
.package(url: "https://github.com/JohnSundell/Plot", from: "0.14.0"),
19+
//.package(url: "https://github.com/toucansites/toucan", from: "1.0.0-alpha.1"), // unstable
20+
//.package(url: "https://github.com/robb/Swim", from: "0.4.0") // compile problem
21+
.package(url: "https://github.com/dokun1/Vaux", from: "0.2.0") // result limitation
1922
],
2023
targets: [
2124
.target(
@@ -63,6 +66,22 @@ let package = Package(
6366
],
6467
path: "Benchmarks/SwiftHTMLPF"
6568
),
69+
.target(
70+
name: "TestSwim",
71+
dependencies: [
72+
"Utilities",
73+
/*.product(name: "Swim", package: "Swim"),
74+
.product(name: "HTML", package: "Swim")*/
75+
],
76+
path: "Benchmarks/Swim"
77+
),
78+
.target(
79+
name: "TestToucan",
80+
dependencies: [
81+
"Utilities"
82+
],
83+
path: "Benchmarks/Toucan"
84+
),
6685
.target(
6786
name: "TestVaporHTMLKit",
6887
dependencies: [
@@ -72,6 +91,14 @@ let package = Package(
7291
],
7392
path: "Benchmarks/VaporHTMLKit"
7493
),
94+
.target(
95+
name: "TestVaux",
96+
dependencies: [
97+
"Utilities",
98+
.product(name: "Vaux", package: "Vaux")
99+
],
100+
path: "Benchmarks/Vaux"
101+
),
75102

76103
.executableTarget(
77104
name: "Benchmarks",
@@ -82,7 +109,10 @@ let package = Package(
82109
"TestSwiftHTMLBB",
83110
"TestSwiftHTMLKit",
84111
"TestSwiftHTMLPF",
112+
"TestSwim",
113+
"TestToucan",
85114
"TestVaporHTMLKit",
115+
"TestVaux",
86116
.product(name: "Benchmark", package: "package-benchmark")
87117
],
88118
path: "Benchmarks/Benchmarks",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ Use the `HTMLElementAttribute.event(<type>, "<value>")`.
141141
## Benchmarks
142142
- Libraries tested
143143
- [sliemeobn/elementary](https://github.com/sliemeobn/elementary) v0.3.4
144-
- [vapor-community/HTMLKit](https://github.com/vapor-community/HTMLKit) v2.8.1
145144
- [JohnSundell/Plot](https://github.com/JohnSundell/Plot) v0.14.0
146-
- [pointfreeco/swift-html](https://github.com/pointfreeco/swift-html) v0.4.1
147145
- [RandomHashTags/swift-htmlkit](https://github.com/RandomHashTags/swift-htmlkit) v0.4.0 (this library)
146+
- [pointfreeco/swift-html](https://github.com/pointfreeco/swift-html) v0.4.1
147+
- [vapor-community/HTMLKit](https://github.com/vapor-community/HTMLKit) v2.8.1
148148
<details>
149149
<summary>Results</summary>
150150
At least on my iMac (i9 9900k, 72GB RAM, 2TB) using macOS 15.0 and the Swift 6 compiler.

0 commit comments

Comments
 (0)