]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/profile-property-access.ly
coverage fixes.
[lilypond.git] / input / regression / profile-property-access.ly
1 \header {
2   texidoc = "This file profiles property accesses; the log file shows the top properties examined."
3 }
4
5
6 #(ly:set-option 'profile-property-accesses #t)
7
8 \version "2.10.8"
9
10 \include "../../input/typography-demo.ly"
11 %\book { \score { {c4 } } }
12
13 #(define (prop-stats>?  x y) (> (cdr x) (cdr y)))
14
15 #(define (display-stats what hash)
16   (let*
17    ((count 50)
18     (rnd 10))
19   (ly:progress "\n~A properties, top ~a rounded to ~a\n~a"
20    what count rnd
21    (string-join
22     (map (lambda (x) (format "~30a: ~6@a" (car x) (* rnd (inexact->exact (round (/ (cdr x) rnd))))))
23      (take 
24     (sort (hash-table->alist hash) prop-stats>?) count))
25     "\n"))))
26    
27
28                                  
29 #(display-stats "Context" (ly:context-property-lookup-stats))
30
31 #(display-stats "Grob" (ly:grob-property-lookup-stats))
32
33