Skip to content
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

Organize performance benchmarks #95

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c8ff0b6
document SDK makefile targets
countvajhula Mar 7, 2023
dd7051d
makefile target for performance regression report
countvajhula Mar 7, 2023
32116d8
Refactor benchmarks to unify form-related ones
countvajhula Mar 8, 2023
7c955e8
start to separate form benchmarks from other benchmarks
countvajhula Mar 8, 2023
1a51450
Organize scripts to generate performance reports
countvajhula Mar 8, 2023
49a827a
Use require-latency library instead of measuring load time locally
countvajhula Mar 8, 2023
eaa26cf
move competitive benchmarks into a separate folder
countvajhula Mar 8, 2023
87fed46
update phonies in makefile
countvajhula Mar 8, 2023
3958320
merge some require forms
countvajhula Mar 8, 2023
662a0bc
categorize performance modules into intrinsic vs competitive
countvajhula Mar 8, 2023
25a267a
rename a file for uniformity
countvajhula Mar 8, 2023
f82f1ba
begin refactor of competitive benchmarks for uniformity/tractability
countvajhula Mar 15, 2023
e967c1b
label a todo so it doesn't get lost
countvajhula Mar 15, 2023
a4517fa
standardize nonlocal benchmark names for use via CLI
countvajhula Mar 15, 2023
c213a94
support selecting specific nonlocal benchmarks to run via CLI
countvajhula Mar 15, 2023
9411eaf
standardize flag conventions
countvajhula Mar 15, 2023
09b24c4
reorganize benchmarks as local and nonlocal
countvajhula Mar 15, 2023
551b9a1
continue reorganizing benchmarks..
countvajhula Mar 15, 2023
7c34773
run nonlocal benchmarks for racket or qi via CLI
countvajhula Mar 15, 2023
71c638e
use regression logic to implement competitive benchmarks
countvajhula Mar 15, 2023
a3f230e
respect CLI flags in performance regression reporting
countvajhula Mar 15, 2023
a796dac
check regression wrt the "after" data to respect narrowed selection
countvajhula Mar 15, 2023
e055609
update makefile targets and name things consistently
countvajhula Mar 15, 2023
ab28a32
improve live output in competitive report
countvajhula Mar 15, 2023
0033742
cleanup, remove unused imports
countvajhula Mar 15, 2023
73b5b6b
use "local" instead of "forms"
countvajhula Mar 15, 2023
916b7b9
add back needed import
countvajhula Mar 15, 2023
f8f3e8a
add nonlocal benchmarks to the performance report
countvajhula Mar 22, 2023
e2bcf06
contain load path parameter to eval where it's needed
countvajhula Mar 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: make install-sdk
- name: Run benchmark
shell: 'bash --noprofile --norc -eo pipefail {0}'
run: make form-performance-report | tee benchmarks.txt
run: make performance-report | tee benchmarks.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
Expand Down
39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ DEPS-FLAGS=--check-pkg-deps --unused-pkg-deps

help:
@echo "install - install package along with dependencies"
@echo "install-sdk - install the SDK which includes developer tools"
@echo "remove - remove package"
@echo "remove-sdk - remove SDK; this will not remove SDK dependencies"
@echo "build - Compile libraries"
@echo "build-docs - Build docs"
@echo "build-standalone-docs - Build self-contained docs that could be hosted somewhere"
@echo "build-all - Compile libraries, build docs, and check dependencies"
@echo "clean - remove all build artifacts"
@echo "clean-sdk - remove all build artifacts in SDK paths"
@echo "check-deps - check dependencies"
@echo "test - run tests"
@echo "test-with-errortrace - run tests with error tracing"
Expand All @@ -37,9 +40,14 @@ help:
@echo "docs - view docs in a browser"
@echo "profile - Run comprehensive performance benchmarks"
@echo "profile-competitive - Run competitive benchmarks"
@echo "profile-forms - Run benchmarks for individual Qi forms"
@echo "profile-local - Run benchmarks for individual Qi forms"
@echo "profile-nonlocal - Run nonlocal benchmarks exercising many components at once"
@echo "profile-selected-forms - Run benchmarks for Qi forms by name (command only)"
@echo "form-performance-report - Run benchmarks for Qi forms and produce results for use in CI"
@echo "performance-report - Run benchmarks for Qi forms and produce results for use in CI and for measuring regression"
@echo " For use in regression: make performance-report > /path/to/before.json"
@echo "performance-regression-report - Run benchmarks for Qi forms against a reference report."
@echo " make performance-regression-report REF=/path/to/before.json"


# Primarily for use by CI.
# Installs dependencies as well as linking this as a package.
Expand Down Expand Up @@ -162,20 +170,27 @@ cover: coverage-check coverage-report
cover-coveralls:
raco cover -b -f coveralls -p $(PACKAGE-NAME)-{lib,test}

profile-forms:
echo "Profiling forms..."
racket $(PACKAGE-NAME)-sdk/profile/forms.rkt
profile-local:
racket $(PACKAGE-NAME)-sdk/profile/local/report.rkt

profile-loading:
racket $(PACKAGE-NAME)-sdk/profile/loading/report.rkt

profile-selected-forms:
@echo "Use 'racket $(PACKAGE-NAME)-sdk/profile/forms.rkt' directly, with -f form-name for each form."
@echo "Use 'racket $(PACKAGE-NAME)-sdk/profile/local/report.rkt' directly, with -s form-name for each form."

profile-competitive:
echo "Running competitive benchmarks..."
racket $(PACKAGE-NAME)-sdk/profile/competitive.rkt
cd $(PACKAGE-NAME)-sdk/profile/nonlocal; racket report-competitive.rkt

profile-nonlocal:
cd $(PACKAGE-NAME)-sdk/profile/nonlocal; racket report-intrinsic.rkt -l qi

profile: profile-local profile-nonlocal profile-loading

profile: profile-competitive profile-forms
performance-report:
@racket $(PACKAGE-NAME)-sdk/profile/report.rkt -f json

form-performance-report:
@racket $(PACKAGE-NAME)-sdk/profile/report.rkt
performance-regression-report:
@racket $(PACKAGE-NAME)-sdk/profile/report.rkt -r $(REF)

.PHONY: help install remove build build-docs build-all clean check-deps test test-flow test-on test-threading test-switch test-definitions test-macro test-util test-probe test-with-errortrace errortrace errortrace-flow errortrace-on errortrace-threading errortrace-switch errortrace-definitions errortrace-macro errortrace-util errortrace-probe docs cover coverage-check coverage-report cover-coveralls profile-forms profile-selected-forms profile-competitive profile form-performance-report
.PHONY: help install remove build build-docs build-all clean check-deps test test-flow test-on test-threading test-switch test-definitions test-macro test-util test-probe test-with-errortrace errortrace errortrace-flow errortrace-on errortrace-threading errortrace-switch errortrace-definitions errortrace-macro errortrace-util errortrace-probe docs cover coverage-check coverage-report cover-coveralls profile-local profile-loading profile-selected-forms profile-competitive profile-nonlocal profile performance-report performance-regression-report
2 changes: 1 addition & 1 deletion qi-doc/scribblings/field-guide.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Another way to do it is to simply promote the expression out of the nest:
(~> (3) (get-f 1))
]

@;{Update this to reflect new partial application behavior}
@;{TODO: Update this to reflect new partial application behavior}
Now, you might, once again, expect this to be treated as a partial application template, so that this would be equivalent to @racket[(get-f 3 1)] and would raise an error. But in fact, since the expression @racket[(get-f 1)] happens to be fully qualified with all the arguments it needs, the currying employed under the hood to implement partial application in this case @seclink["Using_Racket_to_Define_Flows"]{evaluates to a function result right away}. This then receives the value @racket[3], and consequently, this expression produces the correct result.

So in sum, it's perhaps best to rely on @racket[esc] in such cases to be as explicit as possible about what you mean, rather than rely on quirks of the implementation that are revealed at this boundary between two languages.
Expand Down
1 change: 1 addition & 0 deletions qi-sdk/info.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"collections-lib"
"relation-lib"
"csv-writing"
"require-latency"
"cover"
"cover-coveralls"))
(define build-deps '())
Expand Down
77 changes: 0 additions & 77 deletions qi-sdk/profile/competitive.rkt

This file was deleted.

16 changes: 16 additions & 0 deletions qi-sdk/profile/loading/loadlib.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env racket
#lang racket/base

(provide profile-load)

(require pkg/require-latency
racket/format)

(define (profile-load module-name)
(let ([name (~a "(require " module-name ")")]
[ms (cdr (time-module-ms module-name))])
(displayln (~a name ": " ms " ms")
(current-error-port))
(hash 'name name
'unit "ms"
'value ms)))
41 changes: 41 additions & 0 deletions qi-sdk/profile/loading/report.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env racket
#lang cli

(require racket/match
racket/format
relation
qi
(only-in "../util.rkt"
only-if
for/call
write-csv
format-output)
"../regression.rkt"
"loadlib.rkt")

(help
(usage
(~a "Measure module load time, i.e. the time taken by (require qi).")))

(flag (output-format #:param [output-format ""] fmt)
("-f"
"--format"
"Output format to use, either 'json' or 'csv'. If none is specified, no output is generated.")
(output-format fmt))

(flag (regression-file #:param [regression-file #f] reg-file)
("-r" "--regression" "'Before' data to compute regression against")
(regression-file reg-file))

(program (main)
(displayln "\nMeasuring module load time..." (current-error-port))

(let ([output (profile-load "qi")])
(if (regression-file)
(let ([before (parse-benchmarks (parse-json-file (regression-file)))]
[after (parse-benchmarks output)])
(format-output (compute-regression before after)
(output-format)))
(format-output output (output-format)))))

(run main)
48 changes: 0 additions & 48 deletions qi-sdk/profile/loadlib.rkt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

(provide (all-from-out racket/base)
(all-from-out qi)
(all-from-out "util.rkt")
(all-from-out "../util.rkt")
sqr)

(require qi
"util.rkt"
"../util.rkt"
(only-in math sqr))


Loading