Skip to content

Commit 33d3df2

Browse files
authored
Attempt to fix this (#74)
1 parent 50693c6 commit 33d3df2

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

.github/workflows/bench-mpmc.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ jobs:
200200
thr_unit = ""
201201
}
202202
# Look for current throughput in "thrpt:" line before change section
203-
/^ *thrpt: *\\[/ && !in_change_section {
203+
/^ *thrpt: *\[/ && !in_change_section {
204204
# Extract the middle value from [lower middle upper]
205205
# Format: [34.030 Melem/s 34.345 Melem/s 34.641 Melem/s]
206206
# After split: [1]=34.030 [2]=Melem/s [3]=34.345 [4]=Melem/s [5]=34.641 [6]=Melem/s
207-
match($0, /\\[([^]]+)\\]/, arr)
207+
match($0, /\[([^]]+)\]/, arr)
208208
split(arr[1], thrpts, " ")
209209
# Verify we have enough elements (at least 4 for value and unit)
210210
if (length(thrpts) >= 4) {
@@ -227,13 +227,31 @@ jobs:
227227
228228
# Verify we have at least 2 elements
229229
if (length(changes) >= 2) {
230-
change_pct = changes[2]
230+
change_pct_str = changes[2]
231+
# Remove % sign and convert to number
232+
gsub(/%/, "", change_pct_str)
233+
time_change = change_pct_str + 0.0
234+
235+
# Convert time change to throughput change
236+
# If time decreased by X%, throughput increased by X/(1-X/100)%
237+
# If time increased by X%, throughput decreased by X/(1+X/100)%
238+
if (time_change < 0) {
239+
# Time decreased, throughput increased
240+
thrpt_change = (-time_change) / (1 + time_change/100)
241+
thrpt_change_str = sprintf("+%.2f%%", thrpt_change)
242+
} else if (time_change > 0) {
243+
# Time increased, throughput decreased
244+
thrpt_change = (-time_change) / (1 + time_change/100)
245+
thrpt_change_str = sprintf("%.2f%%", thrpt_change)
246+
} else {
247+
thrpt_change_str = "0.00%"
248+
}
231249
232250
if (current_thr != "" && thr_unit != "") {
233-
current_change = sprintf("%s %s (%s)", current_thr, thr_unit, change_pct)
251+
current_change = sprintf("%s %s (%s)", current_thr, thr_unit, thrpt_change_str)
234252
} else {
235253
# Fallback to just percentage if we cannot parse throughput
236-
current_change = change_pct
254+
current_change = thrpt_change_str
237255
}
238256
}
239257

.github/workflows/bench-spsc.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,32 @@ jobs:
224224
225225
# Verify we have at least 2 elements
226226
if (length(changes) >= 2) {
227-
change_pct = changes[2]
227+
change_pct_str = changes[2]
228+
# Remove % sign and convert to number
229+
gsub(/%/, "", change_pct_str)
230+
time_change = change_pct_str + 0.0
231+
232+
# Convert time change to throughput change
233+
# If time decreased by X%, throughput increased by X/(1-X/100)%
234+
# If time increased by X%, throughput decreased by X/(1+X/100)%
235+
if (time_change < 0) {
236+
# Time decreased, throughput increased
237+
thrpt_change = (-time_change) / (1 + time_change/100)
238+
thrpt_change_str = sprintf("+%.2f%%", thrpt_change)
239+
} else if (time_change > 0) {
240+
# Time increased, throughput decreased
241+
thrpt_change = (-time_change) / (1 + time_change/100)
242+
thrpt_change_str = sprintf("%.2f%%", thrpt_change)
243+
} else {
244+
thrpt_change_str = "0.00%"
245+
}
228246
229247
# Report current throughput with percent change if available
230248
if (current_thr != "" && thr_unit != "") {
231-
current_change = sprintf("%s %s (%s)", current_thr, thr_unit, change_pct)
249+
current_change = sprintf("%s %s (%s)", current_thr, thr_unit, thrpt_change_str)
232250
} else {
233-
# Fallback to just percentage if we cannot parse time
234-
current_change = change_pct
251+
# Fallback to just percentage if we cannot parse throughput
252+
current_change = thrpt_change_str
235253
}
236254
}
237255

0 commit comments

Comments
 (0)