Last active
June 11, 2024 13:17
-
-
Save kkebo/daf0592475542c8aef24c70235cd988e to your computer and use it in GitHub Desktop.
generates a bullet list of https://github.com/kkebo/zyphy/issues/61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let titles = ["lipsum", "lipsum-zh", "medium-fragment", "small-fragment", "tiny-fragment", "strong"] | |
let html5everResults = "14330 7331.2 31141 3033.7 300.56 18179" // ns | |
let zyphyResults = "14000 1619 44000 4628 506 20000" // ns | |
let howSlowers = zip( | |
html5everResults.split(separator: " ").map { Double($0)! }, | |
zyphyResults.split(separator: " ").map { Double($0)! } | |
) | |
.map { $1 / $0 } | |
for (title, howSlower) in zip(titles, howSlowers) { | |
if howSlower < 1 / 1.2 { | |
// faster | |
print("- ⚡️ \(title): \((1 / howSlower).formatted(.number.precision(.fractionLength(2))))x faster than html5ever") | |
} else if howSlower < 1 { | |
// a bit faster | |
print("- ✅ \(title): \((1 / howSlower).formatted(.number.precision(.fractionLength(2))))x faster than html5ever") | |
} else if howSlower < 1.2 { | |
// not so slow | |
print("- ✅ \(title): \(howSlower.formatted(.number.precision(.fractionLength(2))))x slower than html5ever") | |
} else { | |
print("- 🐢 \(title): \(howSlower.formatted(.number.precision(.fractionLength(2))))x slower than html5ever") | |
} | |
} | |
print() | |
print("(generated by https://gist.github.com/kkebo/daf0592475542c8aef24c70235cd988e)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment