emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc-mode fontification feels random


From: Stefan Monnier
Subject: Re: cc-mode fontification feels random
Date: Fri, 11 Jun 2021 14:42:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> M-: (time-it (scroll-up-window) (sit-for 0))
>>>
>>> on regions of text which are not yet fontified.  My window has 65 lines
>>> of buffer text.  Starting at the middle of xdisp.c, I see the following
>>> timings for the first few scrolls:
>>>
>>>     0.026s, 0.025s, 0.026s, 0.078s, 0.026s, 0.027s.
>>>
>>> That is, with the exception of the fourth timing, the scroll operation
>>> takes a little over 1/40 second.

FWIW, see below my measurements using Emacs's `master` with the compile
options I happen to use (i.e. extra checks and -Og) on my almost still
new Librem mini (which was running at ~4GHz during that time, so I'd
expect it to be about twice as fast as what I'd see with most of my
other machines).

I used pretty much your above test, except I started it at BOB of
xdisp.c and used:

    M_: (dotimes (_ 700)
          (message "%S" (benchmark-elapse (scroll-up) (sit-for 0)))
          (sleep-for 0.05))

As you can see, the speed doesn't get noticeably worse as we go further
into the file (the first few screenfuls were a bit faster, but after
that it's a wash).

Eli, do you see similar results?
Would you say that this shows the slow behaviors that bother you?

E.g. there used to be a time where I found CC-mode unusably slow in some
cases, but these were typically while editing rather than while
scrolling (i.e. even simple buffer modifications incurred delays
measured in seconds).

FWIW, I ran this same test with `sm-c-mode` (which should handle `xdisp.c`
about as well as CC-mode, but solves an easier problem since it doesn't
try to handle as much of C as CC-mode does (e.g. no support for K&R, no
highlighting of types), nor does it try to handle C++, Java, ...), and
most of the times for it are between 0.02 and 0.04.


        Stefan


0.064421217
0.053839483
0.044885893
0.043997597
0.092963631
0.042693633
0.099381721
0.128002545
0.094545212
0.163745893
0.105989807
0.055903411
0.10900201
0.111409377
0.194541712
0.153313625
0.109133194
0.245912877
0.283898722
0.322253988
0.193199986
0.118792661
0.199273251
0.130073771
0.196526213
0.115176187
0.172246163
0.126954015
0.167790303
0.109683224
0.127960426
0.171211834
0.114826649
0.114200165
0.189255059
0.116494687
0.130894337
0.096504964
0.159958961
0.109482149
0.114501549
0.108971213
0.177497445
0.108309423
0.105783162
0.168977695
0.100549815
0.103706478
0.092696073
0.10432707
0.173879201
0.175646549
0.111500935
0.118432586
0.12011896
0.172456591
0.177120433
0.104136632
0.099530361
0.127795086
0.176916521
0.138550313
0.114789114
0.17856252
0.118454075
0.117133346
0.101272965
0.099138115
0.116056804
0.126078027
0.163253319
0.127315341
0.185968183
0.124788531
0.182340263
0.130805359
0.121452585
0.125351387
0.139440851
0.107537455
0.186858364
0.120384479
0.133356353
0.131290683
0.168943064
0.136992182
0.12346563
0.112871744
0.122782849
0.106021947
0.262331903
0.118295096
0.185145874
0.118002528
0.24931801
0.104444512
0.120716476
0.167382408
0.11458813
0.125722018
0.098804093
0.179202455
0.12640851
0.174556734
0.11220414
0.109073496
0.111259698
0.11418513
0.108025927
0.122940442
0.191836234
0.113417345
0.120711433
0.172513071
0.114420954
0.106913074
0.120929181
0.112327071
0.115024723
0.112698933
0.117357841
0.171556781
0.108914295
0.122564707
0.171817164
0.124725584
0.116682097
0.110775186
0.189281251
0.123835457
0.116927855
0.122824897
0.195963401
0.127717141
0.142261624
0.209577271
0.13124328
0.105018838
0.140045227
0.117403158
0.170725313
0.11485384
0.09650258
0.110668479
0.117975569
0.113766316
0.112954986
0.174354914
0.112653174
0.127833658
0.180525967
0.108714222
0.114321764
0.181837745
0.105400609
0.116630508
0.118542553
0.110567673
0.110128366
0.118041019
0.118595549
0.115326382
0.109436946
0.115400399
0.111347021
0.18042566
0.118994131
0.115646883
0.104489214
0.130443576
0.115561413
0.11330043
0.170368134
0.119400101
0.110526952
0.114555681
0.112566447
0.115888525
0.113044462
0.188394244
0.119813541
0.126508385
0.108936934
0.188695379
0.128201612
0.097573221
0.204059025
0.122495487
0.116058655
0.201060241
0.212312514
0.190197327
0.149310586
0.260126393
0.115149485
0.125418184
0.18942006
0.118149107
0.117835293
0.172673811
0.119002821
0.126055033
0.187659521
0.185205005
0.182849187
0.116862462
0.113111974
0.12542143
0.175057205
0.126864337
0.176218651
0.105942454
0.191953882
0.109533068
0.126686414
0.12604197
0.110572607
0.169785167
0.192896603
0.124740572
0.105335305
0.181733158
0.126450975
0.193657901
0.109094171
0.121084347
0.119585141
0.18067882
0.124754366
0.121194971
0.113421604
0.199118707
0.120581752
0.123201428
0.112947635
0.199405214
0.118820273
0.194467066
0.139457159
0.122085324
0.207810103
0.127238785
0.142071442
0.135402281
0.185030134
0.117510442
0.130970326
0.203497039
0.112685073
0.123192423
0.114474405
0.117449097
0.119929349
0.178402479
0.044960255
0.184778022
0.13186773
0.113406861
0.121064466
0.121199285
0.17902352
0.126698071
0.121117545
0.120106224
0.105877834
0.122465264
0.119232435
0.122804551
0.181922471
0.108515085
0.137086941
0.183930017
0.115787167
0.11794999
0.121208862
0.1163856
0.112712585
0.125896637
0.116050806
0.122970697
0.209042021
0.114536011
0.12732074
0.11918999
0.126965367
0.114274393
0.110505228
0.124278297
0.126557099
0.139104688
0.187700593
0.148332242
0.122385495
0.119986772
0.13254469
0.11980965
0.120371393
0.118032327
0.125577788
0.116801037
0.134561984
0.123288516
0.203589458
0.133222843
0.120893941
0.115931088
0.055410411
0.189834458
0.122465816
0.113808715
0.125036054
0.130117908
0.118056582
0.122033541
0.116559544
0.125301083
0.116939394
0.111072544
0.058279055
0.18299224
0.109533422
0.127404332
0.049588377
0.126764598
0.123352779
0.178826006
0.142064223
0.123598934
0.135688938
0.116330035
0.132189803
0.11364705
0.123380271
0.122618636
0.121231604
0.124962892
0.127782382
0.115393903
0.127666529
0.128069211
0.127825324
0.202362599
0.148214603
0.047154273
0.207692422
0.140212978
0.131902642
0.126609117
0.131795201
0.146280119
0.132221744
0.15205663
0.149419624
0.12882288
0.143127792
0.127806696
0.108093882
0.127447566
0.125514061
0.151355249
0.142197844
0.128111287
0.126984641
0.111681458
0.059230937
0.18387953
0.131424016
0.127260813
0.123185942
0.12301305
0.198837465
0.201908502
0.118353592
0.116802308
0.220584087
0.122908136
0.143131345
0.195682054
0.056502461
0.120201008
0.127099372
0.111206286
0.120740443
0.139805891
0.130569691
0.121373414
0.128916776
0.116291152
0.129381268
0.12844324
0.132286855
0.127196939
0.119538936
0.119440131
0.055392152
0.133164942
0.123128391
0.119713239
0.122640955
0.140901944
0.232109835
0.05099387
0.157270089
0.120189717
0.149400334
0.148006771
0.135561395
0.114432766
0.124214831
0.127588578
0.133017473
0.127939599
0.129795445
0.124383374
0.130871816
0.059958365
0.13643085
0.116147862
0.126365698
0.126586554
0.073479631
0.113455843
0.138131483
0.122755288
0.130340758
0.123803689
0.133688313
0.133731208
0.058815443
0.129348146
0.21755063
0.042720055
0.205209919
0.053552988
0.135913777
0.129090985
0.126755467
0.054468177
0.143547192
0.127561568
0.125057471
0.135675527
0.153656282
0.135994205
0.124501244
0.126975785
0.212048008
0.052969663
0.208492798
0.136217596
0.128715781
0.130466549
0.133027079
0.142198028
0.139497757
0.107914384
0.157040902
0.132118866
0.059025412
0.231755541
0.072431096
0.237608949
0.132376274
0.128392519
0.048447206
0.143444946
0.216714502
0.113765814
0.138750278
0.054166292
0.125345491
0.123151466
0.130740236
0.130040994
0.132336243
0.131015359
0.120283476
0.0819551
0.12897466
0.119582391
0.099782304
0.146355992
0.071737352
0.12601306
0.119875996
0.149615954
0.164011924
0.113920676
0.148488657
0.204961462
0.046083269
0.132240597
0.120290724
0.133797299
0.118957392
0.050409076
0.132897864
0.130272527
0.123380237
0.124661648
0.117979764
0.051353461
0.137747574
0.135186988
0.144030045
0.139358571
0.143437272
0.150285771
0.123336112
0.13059152
0.134459129
0.057900639
0.128294124
0.130709936
0.142835662
0.124570338
0.157248237
0.05272827
0.159828425
0.131068281
0.129289379
0.159432997
0.050178936
0.137730101
0.139991591
0.117379933
0.152119491
0.130505849
0.131793548
0.133941495
0.132393249
0.064910953
0.135175145
0.137056085
0.128050285
0.124205486
0.054973603
0.137880713
0.13144247
0.130749717
0.132145462
0.129195918
0.133067051
0.050073898
0.137713601
0.127667884
0.066216357
0.218338173
0.137968321
0.063958844
0.134524174
0.129759992
0.132279705
0.05465503
0.136361192
0.137618427
0.135622113
0.135047758
0.076815814
0.134360997
0.131905126
0.135704933
0.132362084
0.058676068
0.131205555
0.138812341
0.129555152
0.137330679
0.054380999
0.240273459
0.062407346
0.150339943
0.141908294
0.07518077
0.12682164
0.152640432
0.147469145
0.054359045
0.157950419
0.246097952
0.061191826
0.228765419
0.145952982
0.053982302
0.137021757
0.138045217
0.123689763
0.069250831
0.125857663
0.117612075
0.138906825
0.064224531
0.14983241
0.142864541
0.141848561
0.12703107
0.134363931
0.129297234
0.143293068
0.05942274
0.151750642
0.129740556
0.141618794
0.157558284
0.15051779
0.130591822
0.147420673
0.129570717
0.066815203
0.127132384
0.129291855
0.237577516
0.150971169
0.133464307
0.136805642
0.137268469
0.138594698
0.058999963
0.151746548
0.148502547
0.126773309
0.079724232
0.134307193
0.164472372
0.159711969
0.148037259
0.14977967
0.16937488
0.048476567
0.154464051
0.041739919
let: End of buffer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]