Skip to content

Commit 54ce95c

Browse files
authored
Update performance.pod6
1 parent f705a6f commit 54ce95c

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

doc/Language/performance.pod6

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,40 @@ To learn how to interpret the profile info, ask questions on channel.
4747
=head2 Profile locally
4848
4949
When using the L<MoarVM|http://moarvm.org> backend the L<Rakudo|http://rakudo.org> compiler's C<--profile>
50-
command line option writes profile information as an HTML file.
50+
command line option writes profile information as an HTML file. However, if the profile is too big it can
51+
be slow to open in a browser. In that case, if you use the C<--profile-filename=file.extension> option with
52+
an extension of C<.json>, you can use the L<Qt viewer|https://github.com/tadzik/p6profiler-qt> on the resulting
53+
JSON file.
54+
55+
Another option (especially useful for profiles too big even for the Qt viewer) is to use an extention of C<.sql>.
56+
This will write the profile data as a series of SQL statements, suitable for opening in SQLite.
57+
58+
# create a profile
59+
perl6 --profile --profile-filename=demo.sql -e 'say (^20).combinations(3).elems'
60+
61+
# create a SQLite database
62+
sqlite3 demo.sql
63+
64+
# load the profile data
65+
sqlite> .read demo.sql
66+
67+
# the query below is equivalent to the default view of the "Routines" tab in the HTML file
68+
sqlite> select
69+
...> case when r.name = "" then "<anon>" else r.name end,
70+
...> r.file,
71+
...> r.line,
72+
...> sum(entries) as entries,
73+
...> sum(case when rec_depth = 0 then inclusive_time else 0 end) as inclusive_time,
74+
...> sum(exclusive_time) as exclusive_time
75+
...> from
76+
...> callees c,
77+
...> routines r
78+
...> where
79+
...> c.id = r.id
80+
...> group by
81+
...> c.id
82+
...> order by
83+
...> inclusive_time desc;
5184
5285
To learn how to interpret the profile info, use the C<prof-m: your code goes here> evalbot (explained
5386
above) and ask questions on channel.

0 commit comments

Comments
 (0)