Skip to content

Commit

Permalink
Merge pull request #162 from countvajhula/proper-profiling
Browse files Browse the repository at this point in the history
Towards proper profiling
  • Loading branch information
countvajhula authored Mar 6, 2024
2 parents 35291ce + 7a5671d commit 2da0dcd
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 23 deletions.
47 changes: 28 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ help:
@echo "coverage-check - Run test coverage checker"
@echo "coverage-report - View test coverage report"
@echo "docs - view docs in a browser"
@echo "profile - Run comprehensive performance benchmarks"
@echo "profile-competitive - Run competitive benchmarks"
@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 "profile - Get a performance profile of any Racket command"
@echo "benchmark - Run comprehensive performance benchmarks"
@echo "benchmark-competitive - Run competitive benchmarks"
@echo "benchmark-local - Run benchmarks for individual Qi forms"
@echo "benchmark-nonlocal - Run nonlocal benchmarks exercising many components at once"
@echo "benchmark-selected-forms - Run benchmarks for Qi forms by name (command only)"
@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."
Expand Down Expand Up @@ -180,27 +181,35 @@ cover: coverage-check coverage-report
cover-coveralls:
raco cover -b -f coveralls -p $(PACKAGE-NAME)-{lib,test}

profile-local:
racket $(PACKAGE-NAME)-sdk/profile/local/report.rkt
profile:
@echo "To get a performance profile:"
@echo " raco profile --total <any Racket command, including arguments>"
@echo "Example:"
@echo " raco profile --total qi-sdk/benchmarks/nonlocal/report-competitive.rkt -s filter-map"
@echo "For more options:"
@echo " raco profile --help"

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

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

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

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

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

benchmark: benchmark-local benchmark-nonlocal benchmark-loading

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

performance-regression-report:
@racket $(PACKAGE-NAME)-sdk/profile/report.rkt -r $(REF)
@racket $(PACKAGE-NAME)-sdk/benchmarks/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-expander test-compiler 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
.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-expander test-compiler 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 benchmark-local benchmark-loading benchmark-selected-forms benchmark-competitive benchmark-nonlocal benchmark performance-report performance-regression-report
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env racket
#lang racket/base

(provide profile-load)
(provide require-latency)

(require pkg/require-latency
racket/format)

(define (profile-load module-name)
(define (require-latency module-name)
(let ([name (~a "(require " module-name ")")]
[ms (cdr (time-module-ms module-name))])
(displayln (~a name ": " ms " ms")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
(program (main)
(displayln "\nMeasuring module load time..." (current-error-port))

(let ([output (profile-load "qi")])
(let ([output (require-latency "qi")])
(if (regression-file)
(let ([before (parse-benchmarks (parse-json-file (regression-file)))]
[after (parse-benchmarks output)])
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion qi-sdk/profile/report.rkt → qi-sdk/benchmarks/report.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(n:benchmark "qi" (selected))
null)]
[require-data (if (member? (report-type) (list "all" "loading"))
(list (profile-load "qi"))
(list (require-latency "qi"))
null)]
[output (~ local-data nonlocal-data require-data)])
(if (regression-file)
Expand Down
File renamed without changes.

0 comments on commit 2da0dcd

Please sign in to comment.