From abb898b73af65eabb9465a9a26db488d4e330925 Mon Sep 17 00:00:00 2001 From: Artemis Everfree Date: Wed, 22 Mar 2023 21:43:04 -0700 Subject: [PATCH 1/2] benchmark flamegraph w/profile-flame-graph & flamegraph.pl --- lib/tree-updater.rkt | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/tree-updater.rkt b/lib/tree-updater.rkt index 074c5a1..bb16792 100644 --- a/lib/tree-updater.rkt +++ b/lib/tree-updater.rkt @@ -3,6 +3,7 @@ racket/function racket/match racket/string + profile-flame-graph "pure-utils.rkt" "url-utils.rkt" "xexpr-utils.rkt") @@ -302,4 +303,30 @@ (with-input-from-file "../storage/Frog.html" (λ () (define tree (html->xexp (current-input-port))) - (time (length (update-tree-wiki tree "minecraft"))))))) + (time (length (update-tree-wiki tree "minecraft")))))) + + ; benchmark with flamegraph + ; these two flamegraphs need to be separated i think so that they resolve + ; different thunks. probably only need to be in two different with-input-file + ; blocks. + (when (file-exists? "../storage/Frog.html") + (with-input-from-file "../storage/Frog.html" + (λ () + (define tree (html->xexp (current-input-port))) + (profile + (length (update-tree-wiki tree "minecraft")) + #:svg-path "../storage/Frog-profile-errortrace.svg" + #:repeat 100 + #:use-errortrace? #t) + ))) + (when (file-exists? "../storage/Frog.html") + (with-input-from-file "../storage/Frog.html" + (λ () + (define tree (html->xexp (current-input-port))) + (profile + (length (update-tree-wiki tree "minecraft")) + #:svg-path "../storage/Frog-profile.svg" + #:repeat 100 + #:use-errortrace? #f) + ))) + ) -- 2.34.1 From 91406af94bf6eb8fdeb4b612ae207b551f8f6d37 Mon Sep 17 00:00:00 2001 From: Artemis Everfree Date: Wed, 22 Mar 2023 22:37:21 -0700 Subject: [PATCH 2/2] test against block instead of frog --- lib/tree-updater.rkt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/tree-updater.rkt b/lib/tree-updater.rkt index bb16792..16a456d 100644 --- a/lib/tree-updater.rkt +++ b/lib/tree-updater.rkt @@ -299,8 +299,8 @@ ; check that noscript images are removed (check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f) ; benchmark - (when (file-exists? "../storage/Frog.html") - (with-input-from-file "../storage/Frog.html" + (when (file-exists? "../storage/Block.html") + (with-input-from-file "../storage/Block.html" (λ () (define tree (html->xexp (current-input-port))) (time (length (update-tree-wiki tree "minecraft")))))) @@ -309,23 +309,23 @@ ; these two flamegraphs need to be separated i think so that they resolve ; different thunks. probably only need to be in two different with-input-file ; blocks. - (when (file-exists? "../storage/Frog.html") - (with-input-from-file "../storage/Frog.html" + (when (file-exists? "../storage/Block.html") + (with-input-from-file "../storage/Block.html" (λ () (define tree (html->xexp (current-input-port))) (profile (length (update-tree-wiki tree "minecraft")) - #:svg-path "../storage/Frog-profile-errortrace.svg" + #:svg-path "../storage/Block-profile-errortrace.svg" #:repeat 100 #:use-errortrace? #t) ))) - (when (file-exists? "../storage/Frog.html") - (with-input-from-file "../storage/Frog.html" + (when (file-exists? "../storage/Block.html") + (with-input-from-file "../storage/Block.html" (λ () (define tree (html->xexp (current-input-port))) (profile (length (update-tree-wiki tree "minecraft")) - #:svg-path "../storage/Frog-profile.svg" + #:svg-path "../storage/Block-profile.svg" #:repeat 100 #:use-errortrace? #f) ))) -- 2.34.1