-
-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
max-time-per-run #576
Comments
Thank you for your request. I think the implementation of such a feature would require a LOT of special cases downstream to properly handle the absence of values. Have you considered using sth like
In general: why would you be interested in including benchmarks that would potentially run into a time limit? |
see also: #106 |
To answer the question "why would I be interested in including benchmarks that would potentially run into a time limit?" I am benchmarking a matrix of languages and programs automatically. ALL:=$(patsubst %/,%,$(filter-out \
asm-m68k-amiga-gasm/ \
asm-m68k-amiga-masm/ \
asm-m68k-amiga2-masm/ \
Carbon/ \
Concurnas/ \
Logo/ \
, $(wildcard */)))
.PHONY: hyperfine-roundtrip
hyperfine-roundtrip: hyperfine-roundtrip.csv
hyperfine-roundtrip.csv:
hyperfine --export-csv hyperfine-roundtrip.csv -L variant $(shell echo $(ALL) | sed -e 's/ /,/g') -p 'make -C {variant} clean' 'make -sC {variant}' I think you can see how well Before .PHONY: time-%
time-%:
@for ((i = 0; i < 10; i++)); do
@$(MAKE) -s -C $* clean 2>&1
@start=$$(date -u +'%s%N')
@$(MAKE) -s -C $* >/dev/null 2>&1
@end=$$(date -u +'%s%N')
@echo '$*,'$$(($$end - $$start))
@done
time.csv:
echo 'Language,time (ns)' >$@
$(MAKE) -s time >>$@
clean::
$(RM) time.csv
time-processed.csv: time.csv
sqlite3 >>$@ <<END
.mode csv
.import time.csv times
select "Language", ((1.0 * sum("time (ns)") - max("time (ns)") - min("time (ns)")) / (count("time (ns)") - 2.0)) / 1000000 as "Time (ms)" from times group by "Language" order by "Time (ms)";
END Using For a lot of purposes, (I'm measuring roundtrip times of programming languages, and they can range from a few ms in Perl or Assembler to many seconds like Flix, and it also heavily depends on the problem statement.) |
Don't guess - measure 😄
The overhead seems to be below 1 ms. |
For benchmarking, we already have
-P
,--parameter-scan
, and its more flexible counterpart-L
,--parameter-list
, and that's great. As the example shows, we can use this to runhyperfine
like this:I've now found a use case where a possibility to have
hyperfine
limit the benchmarking runs based on elapsed time could be useful.For benchmarks where performance varies greatly, like between C and bash, it could occasionally be useful to present results as "aborted (took too long)" by having a
--max-time-per-run <TIME>
argument, for example--max-time-per-run 2s
, that will automatically terminate a run and its associated benchmark when its runs take longer than--max-time-per-run
. The values could be output as∞
.The text was updated successfully, but these errors were encountered: