44. DESCRIPTION
55 Builds 4kb Markdown files N different ways, in order to test performance.
66. NOTES
7- In the interests of fair play, any prerequisities should be installed before builds are timed.
7+ In the interests of fair play, any prerequisities should be installed before builds are timed.
88#>
9- param ()
9+ param (
10+ [uri ]
11+ $BuildTimeHistoryUrl = " https://4kb.powershellweb.com/history.json"
12+ )
1013
14+ # Make sure we're in the right place.
1115Push-Location $PSScriptRoot
1216
1317# region Install Prereqs
1418if ($env: GITHUB_WORKFLOW ) {
15- $null = sudo npm install - g ' @11ty/eleventy'
19+ # Install 11ty to reduce 11ty build time
20+ $null = sudo npm install - g ' @11ty/eleventy'
1621
1722 Install-Module MarkX - Force
1823
@@ -41,6 +46,7 @@ $cpuSpeed =
4146# endregion
4247
4348$mySelf = $MyInvocation.MyCommand.ScriptBlock
49+ $StartTime = [DateTime ]::Now
4450
4551& {
4652 foreach ($file in Get-ChildItem - filter build.with.* .ps1) {
@@ -61,16 +67,33 @@ $buildTimes = $buildTimes | Sort-Object Time
6167foreach ($buildTime in $buildTimes ) {
6268 $relativeSpeed = $buildTime.Time.TotalMilliseconds / $buildTimes [-1 ].Time.TotalMilliseconds
6369 Add-Member NoteProperty - InputObject $buildTime - Name RelativeSpeed $relativeSpeed - Force
64- }
70+ Add-Member NoteProperty - InputObject $buildTime - Name DateTime $StartTime - Force
71+ }
72+
73+ $history = @ (try {
74+ Invoke-RestMethod - Uri $BuildTimeHistoryUrl - ErrorAction Ignore
75+ } catch {
76+ $null
77+ })
78+
79+ $history += $buildTimes |
80+ Select-Object Technique, Time, RelativeSpeed, Date
81+
82+ ConvertTo-Json - InputObject $history > ./ history.json
6583
6684$buildTimes | ConvertTo-Html - Title BuildTimes > ./ times.html
6785
6886@ (
6987 " <html>"
88+
7089 " <head>"
90+
7191 " <title>4kb Markdown Files</title>"
92+
7293 " <meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1.0' />"
94+
7395 " <style>"
96+
7497 "
7598
7699 body { height: 100vh; max-width: 100vw; margin:0 }
0 commit comments