Created
January 31, 2025 17:23
-
-
Save smeech/06f7db477cca0e3e126c3df7d520ccdd to your computer and use it in GitHub Desktop.
[Speed test] between shell: and script: #espanso #powershell
This file contains hidden or 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
# Espanso speed test between shell: and script | |
# No discernible difference here on Linux, but recommend using script: to avoid calling | |
# an unnecessary process | |
# Conversation at https://discord.com/channels/884163483409731584/1013916990760554608/1253033704599846973 | |
global_vars: | |
- name: code | |
type: echo | |
params: | |
echo: | | |
$startTime = Get-Date | |
$processes = Get-Process | |
for ($i = 1; $i -le 1000; $i++) { | |
$sortedProcesses = $processes | Sort-Object -Property CPU -Descending | |
} | |
$endTime = Get-Date | |
$totalTime = New-TimeSpan -Start $startTime -End $endTime | |
Write-Output "Total execution time: $($totalTime.Hours) hours, $($totalTime.Minutes) minutes, $($totalTime.Seconds) seconds." | |
matches: | |
- trigger: :test1 | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
shell: pwsh | |
cmd: "{{code}}" | |
- trigger: :test2 | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: script | |
params: | |
args: | |
- pwsh | |
- -c | |
- "{{code}} " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment