Skip to content

Commit e8b29b4

Browse files
fixed and enabled Vaux benchmarks; updated benchmark pngs
1 parent 0fc4e01 commit e8b29b4

File tree

7 files changed

+61
-11
lines changed

7 files changed

+61
-11
lines changed

Benchmarks/Benchmarks/Benchmarks/Benchmarks.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ let benchmarks = {
2828
"Pointfreeco" : SwiftHTMLPFTests(),
2929
"SwiftHTMLKit" : SwiftHTMLKitTests(),
3030
"Swim" : SwimTests(),
31-
"VaporHTMLKit" : VaporHTMLKitTests()
31+
"VaporHTMLKit" : VaporHTMLKitTests(),
32+
"Vaux" : VauxTests()
3233
]
3334

3435
/*for (key, value) in libraries {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// UnitTests.swift
3+
//
4+
//
5+
// Created by Evan Anderson on 10/6/24.
6+
//
7+
8+
import Testing
9+
import Utilities
10+
11+
import TestVaux
12+
13+
struct UnitTests {
14+
@Test func vaux() {
15+
#expect(VauxTests().staticHTML() != "")
16+
}
17+
}

Benchmarks/Benchmarks/Vaux/Vaux.swift

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import Utilities
99
import Vaux
1010
import Foundation
1111

12-
/*
12+
extension HTML {
13+
var rendered : String { String(describing: self) }
14+
}
15+
1316
package struct VauxTests : HTMLGenerator {
1417

1518
let vaux:Vaux
@@ -18,20 +21,30 @@ package struct VauxTests : HTMLGenerator {
1821
}
1922

2023
package func staticHTML() -> String {
21-
var stream:HTMLOutputStream = HTMLOutputStream(FileHandle.standardOutput, nil)
22-
let content = html {
24+
html {
2325
body {
2426
heading(.h1) {
2527
"Swift HTML Benchmarks"
2628
}
2729
}
28-
}
29-
stream.render(content)
30-
let textoutput:TextOutputStream = stream.output
31-
return ""
30+
}.rendered
3231
}
3332

3433
package func dynamicHTML(_ context: HTMLContext) -> String {
35-
staticHTML()
34+
html {
35+
body {
36+
heading(.h1) { context.heading }
37+
div {
38+
paragraph { context.string }
39+
}.id("desc")
40+
heading(.h2) { context.user.details_heading }
41+
heading(.h3) { context.user.qualities_heading }
42+
list {
43+
forEach(context.user.qualities) {
44+
listItem(label: $0)
45+
}
46+
}.id("user-qualities")
47+
}
48+
}.rendered
3649
}
37-
}*/
50+
}

Benchmarks/Package.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let package = Package(
1818
.package(url: "https://github.com/JohnSundell/Plot", from: "0.14.0"),
1919
//.package(url: "https://github.com/toucansites/toucan", from: "1.0.0-alpha.1"), // unstable
2020
.package(url: "https://github.com/RandomHashTags/fork-Swim", branch: "main"),
21-
.package(url: "https://github.com/dokun1/Vaux", from: "0.2.0"), // result limitation
21+
.package(url: "https://github.com/dokun1/Vaux", from: "0.2.0"),
2222
.package(url: "https://github.com/vapor/leaf", from: "4.4.0"),
2323
],
2424
targets: [
@@ -108,6 +108,24 @@ let package = Package(
108108
path: "Benchmarks/Vaux"
109109
),
110110

111+
.testTarget(
112+
name: "UnitTests",
113+
dependencies: [
114+
"Utilities",
115+
"TestElementary",
116+
"TestLeaf",
117+
"TestPlot",
118+
"TestSwiftHTMLBB",
119+
"TestSwiftHTMLKit",
120+
"TestSwiftHTMLPF",
121+
"TestSwim",
122+
"TestToucan",
123+
"TestVaporHTMLKit",
124+
"TestVaux",
125+
],
126+
path: "Benchmarks/UnitTests"
127+
),
128+
111129
.executableTarget(
112130
name: "Benchmarks",
113131
dependencies: [
17.5 KB
Loading
15.5 KB
Loading

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Use the `HTMLElementAttribute.event(<type>, "<value>")`.
155155
- [pointfreeco/swift-html](https://github.com/pointfreeco/swift-html) v0.4.1
156156
- [robb/Swim](https://github.com/robb/Swim) v0.4.0 (fixed version [here](https://github.com/RandomHashTags/fork-Swim))
157157
- [vapor-community/HTMLKit](https://github.com/vapor-community/HTMLKit) v2.8.1
158+
- [dokun1/Vaux](https://github.com/dokun1/Vaux) v0.2.0
158159

159160
Using iMac (i9 9900k, 72GB RAM, 2TB) with macOS 15.0 and the Swift 6 compiler.
160161

0 commit comments

Comments
 (0)