[CM] Performance of S7

Massimiliano Gubinelli m.gubinelli at gmail.com
Wed Dec 30 15:09:51 PST 2020



> On 30. Dec 2020, at 19:08, Kjetil Matheussen <k.s.matheussen at gmail.com> wrote:
> 
>>> Hash table lookups on symbols should
>>> be fast too, unless I've missed something.  Could you run TeXmacs under
>>> callgrind and send me the results? -- something might jump out at me.
>>> I downloaded TeXmacs, but I don't see the s7 code.
>>> 
>> 
>> 
>> I do  not know callgrind and I'm on Mac usually, does it work there?
>> 
> 
> Probably, but one very dirty, and often efficient, way to find out
> where a program spends its time is simply to interrupt it (e.g. press
> ctrl-c when running in lldb). Do it a few times, and very often it
> will be interrupted where it's spending most of its CPU time.


I cannot use callgrind on Mac (only Linux apparently...) However I tried to run the Xcode profiler and got what I attach below. I've isolated the call in which TeXmacs is spending much of the time when handling keypresses, as I explained in previous mails. The timings are cumulative after some time running and pressing some keys or moving around the cursor. Overall I recorder 80000ms. Does this tell you something?
All the time is spent into c_function_is_ok, closure_is_ok_1 and lookup and for the first two functions the profiler register all the time in lookup.

I also attach a screenshot of the profiler in case the data below does not make much sense.

Max


61798	61798.0ms   77.7%	0,0	 	                      s7_call
61798	61798.0ms   77.7%	0,0	 	                       eval
29814	29814.0ms   37.5%	0,0	 	                        c_function_is_ok
8463	8463.0ms   10.6%	0,0	 	                        closure_is_ok_1
6316	6316.0ms    7.9%	6316,0	 	                        lookup
3267	3267.0ms    4.1%	0,0	 	                        closure_is_ok_1
2645	2645.0ms    3.3%	0,0	 	                        closure_is_ok_1
2529	2529.0ms    3.1%	0,0	 	                        trailers
1732	1732.0ms    2.1%	0,0	 	                        op_c_aa
1435	1435.0ms    1.8%	0,0	 	                        op_macro_d
1331	1331.0ms    1.6%	0,0	 	                        closure_is_ok_1
1307	1307.0ms    1.6%	0,0	 	                        fx_c_s_opsq
1257	1257.0ms    1.5%	0,0	 	                        closure_is_ok_1
566	566.0ms    0.7%	566,0	 	                        lookup
406	406.0ms    0.5%	406,0	 	                        lookup
372	372.0ms    0.4%	0,0	 	                        closure_is_ok_1
87	87.0ms    0.1%	0,0	 	                        closure_is_fine_1
80	80.0ms    0.1%	0,0	 	                        op_c_ss
30	30.0ms    0.0%	30,0	 	                        lookup
27	27.0ms    0.0%	0,0	 	                        op_apply_ss
20	20.0ms    0.0%	0,0	 	                        op_c_ap
17	17.0ms    0.0%	0,0	 	                        op_safe_c_s
12	12.0ms    0.0%	0,0	 	                        closure_is_fine_1
11	11.0ms    0.0%	0,0	 	                        op_safe_c_sc
6	6.0ms    0.0%	0,0	 	                        op_safe_c_ss
6	6.0ms    0.0%	0,0	 	                        op_eval_args3
5	5.0ms    0.0%	0,0	 	                        op_any_c_fp_1
4	4.0ms    0.0%	4,0	 	                        lookup
3	3.0ms    0.0%	0,0	 	                        check_closure_any
3	3.0ms    0.0%	0,0	 	                        eval_args_last_arg
3	3.0ms    0.0%	0,0	 	                        op_macro_d
2	2.0ms    0.0%	0,0	 	                        closure_is_fine_1
2	2.0ms    0.0%	0,0	 	                        op_closure_ass
2	2.0ms    0.0%	2,0	 	                        lookup
2	2.0ms    0.0%	0,0	 	                        op_closure_saa
2	2.0ms    0.0%	0,0	 	                        op_let_a_new
2	2.0ms    0.0%	0,0	 	                        closure_is_ok_1
2	2.0ms    0.0%	0,0	 	                        op_safe_c_ss
2	2.0ms    0.0%	0,0	 	                        closure_is_fine_1
2	2.0ms    0.0%	0,0	 	                        op_safe_c_sc
2	2.0ms    0.0%	0,0	 	                        closure_is_fine_1
2	2.0ms    0.0%	0,0	 	                        closure_is_fine_1
2	2.0ms    0.0%	0,0	 	                        op_closure_ss
1	1.0ms    0.0%	0,0	 	                        fx_c_opsq
1	1.0ms    0.0%	0,0	 	                        op_closure_aa_o
1	1.0ms    0.0%	0,0	 	                        op_and_pair_p
1	1.0ms    0.0%	0,0	 	                        fx_c_opsq_s
1	1.0ms    0.0%	0,0	 	                        op_closure_aas
1	1.0ms    0.0%	0,0	 	                        op_c_ss
1	1.0ms    0.0%	0,0	 	                        op_s_s
1	1.0ms    0.0%	0,0	 	                        closure_is_ok_1
1	1.0ms    0.0%	0,0	 	                        closure_is_ok_1
1	1.0ms    0.0%	0,0	 	                        op_any_closure_3p
1	1.0ms    0.0%	0,0	 	                        op_closure_ass
1	1.0ms    0.0%	0,0	 	                        closure_is_ok_1
1	1.0ms    0.0%	0,0	 	                        op_any_c_fp
1	1.0ms    0.0%	0,0	 	                        op_safe_closure_s_a
1	1.0ms    0.0%	1,0	 	                        lookup
1	1.0ms    0.0%	0,0	 	                        fx_c_opsq_s_direct
1	1.0ms    0.0%	0,0	 	                        closure_is_ok_1
1	1.0ms    0.0%	0,0	 	                        op_safe_closure_aa
1	1.0ms    0.0%	0,0	 	                        closure_is_ok_1
1	1.0ms    0.0%	0,0	 	                        fx_is_null_s

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20201231/44e86961/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2020-12-31 at 00.08.48.png
Type: image/png
Size: 1120773 bytes
Desc: not available
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20201231/44e86961/attachment-0001.png>


More information about the Cmdist mailing list