[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File path completions: strange speed discrepancy
From: |
Michael Albinus |
Subject: |
Re: File path completions: strange speed discrepancy |
Date: |
Mon, 20 Sep 2021 16:29:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
JD Smith <jdtsmith@gmail.com> writes:
Hi,
> In the meantime I’ve searched down many rabbit holes and zeroed in on
> tramp’s file handlers. I am using:
>
> (require 'tramp-sh)
> (defun my/test ()
> (interactive)
> (progn
> (tramp-cleanup-all-connections)
> (elp-instrument-list
> '(file-remote-p
> tramp-file-name-handler
> completion-file-name-table
> tramp-handle-substitute-in-file-name
> substitute-in-file-name
> completion--sifn-requote
> file-name-completion
> file-name-all-completions
> completion--file-name-table
> file-exists-p
> completing-read
> read-file-name-internal
> read-file-name-default
> tramp-handle-file-name-completion
> tramp-sh-handle-file-name-all-completions))
> (setq unread-command-events
> (mapcar 'identity "///ssh:datpi:/home/pi/no\tex\t/do\tma\tce\t\n"))
> (call-interactively #'find-file)
> (let ((elp-recycle-buffers-p nil))
> (elp-results)
> (elp-reset-all))))
>
> ;; first browse to remote directory (here "pi")
> (progn
> (with-current-buffer "pi"
> (my/test))
> (my/test))
Well, tramp-file-name-handler is just a scheduler function, which calls
the respective handler from the different Tramp backends. file-remote-p,
substitute-in-file-name, file-name-completion, file-name-all-completions
and file-exists-p don't need to be traced, because they call Tramp
functions immediately. OTOH, we might supervise all Tramp handle
functions.
Furthermore, I have switched to a remote machine in my LAN, because it
doesn't matter whether the machine is far away. So I have changed the
code snippet to
(progn
(require 'tramp-sh)
(defun my/test ()
(interactive)
(tramp-cleanup-all-connections)
(elp-instrument-list
(append
'(completion-file-name-table
completion--sifn-requote
completion--file-name-table
completing-read
read-file-name-internal
read-file-name-default)
(mapcar #'intern (all-completions "tramp-handle-" obarray 'functionp))
(mapcar #'intern (all-completions "tramp-sh-handle-" obarray
'functionp))))
(setq unread-command-events
(mapcar 'identity "///ssh:detlef:/hom\talbin\tsr\temacs\t/lisp/\t\n"))
(call-interactively #'find-file)
(let ((elp-recycle-buffers-p nil))
(elp-results)
(elp-reset-all)))
(dolist (df '("/ssh::" "/"))
(let ((default-directory df))
(my/test))))
> For me this implicates file-remote-p and tramp-file-name-handler,
> which again exhibit 10x differences between starting in a local or
> remote buffer. If this is fixed in Emacs 28 that’s wonderful, but it
> may be several years before everyone has migrated.
FTR, there won't be Emacs 27.3, Emacs 28.1 is the next version to be
released. In Emacs 28, I see similar discrepancies like in your test:
Results:
default-directory "/":
read-file-name-default 1 5.866054427
5.866054427
tramp-sh-handle-expand-file-name 408 5.1123634760
0.0125303026
completing-read 1 0.821957783
0.821957783
completion-file-name-table 21 0.592267366
0.0282032079
tramp-handle-file-name-completion 5 0.586021974
0.1172043948
tramp-sh-handle-file-name-all-completions 5 0.434829428
0.0869658856
tramp-handle-substitute-in-file-name 184 0.2953856810
0.0016053569
tramp-sh-handle-insert-directory 1 0.271016624
0.271016624
tramp-handle-access-file 1 0.135264637
0.135264637
tramp-handle-file-remote-p 316 0.1301504470
0.0004118685
tramp-sh-handle-file-exists-p 21 0.127348874
0.0060642320
tramp-sh-handle-file-truename 1 0.112487043
0.112487043
tramp-sh-handle-file-directory-p 46 0.0820547759
0.0017837994
tramp-sh-handle-file-attributes 3 0.073989483
0.024663161
completion--sifn-requote 7 0.071225156
0.0101750222
tramp-handle-file-symlink-p 1 0.057292995
0.057292995
tramp-sh-handle-get-remote-gid 2 0.036589462
0.018294731
tramp-handle-file-name-case-insensitive-p 4 0.0251118690
0.0062779672
read-file-name-internal 16 0.024533941
0.0015333713
completion--file-name-table 16 0.024329729
0.0015206080
tramp-sh-handle-file-readable-p 1 0.022343529
0.022343529
tramp-sh-handle-file-system-info 1 0.018551073
0.018551073
tramp-sh-handle-get-remote-uid 1 0.004895242
0.004895242
tramp-handle-file-name-directory 16 0.000261404
1.633775e-05
tramp-handle-directory-file-name 10 0.0002139559
2.13956e-05
tramp-handle-file-name-nondirectory 12 0.0001787970
1.489975e-05
tramp-handle-file-name-as-directory 9 0.000165349
1.837...e-05
default-directory "/ssh::":
read-file-name-default 1 0.851212462
0.851212462
completing-read 1 0.849990537
0.849990537
completion-file-name-table 21 0.7683622459
0.0365886783
tramp-handle-file-name-completion 5 0.7638386700
0.1527677340
tramp-sh-handle-file-name-all-completions 5 0.6473699970
0.1294739994
tramp-sh-handle-file-directory-p 31 0.1518540499
0.0048985177
tramp-sh-handle-file-exists-p 19 0.0916896359
0.0048257703
tramp-handle-substitute-in-file-name 99 0.0487316130
0.0004922385
tramp-sh-handle-file-attributes 1 0.039626914
0.039626914
tramp-handle-file-remote-p 210 0.0295435460
0.0001406835
completion--sifn-requote 7 0.0225724849
0.0032246407
tramp-sh-handle-get-remote-gid 1 0.017265099
0.017265099
tramp-sh-handle-expand-file-name 267 0.0166341830
6.230...e-05
tramp-handle-file-name-case-insensitive-p 2 0.015025221
0.0075126105
read-file-name-internal 16 0.0112979599
0.0007061224
completion--file-name-table 16 0.01114909
0.0006968181
tramp-handle-file-name-directory 10 0.000124537
1.24537e-05
tramp-handle-file-name-nondirectory 6 7.415...e-05
1.235...e-05
tramp-handle-directory-file-name 4 7.0483e-05
1.762075e-05
tramp-handle-file-name-as-directory 2 2.8543e-05
1.42715e-05
However, if I change the order of the test, ie if I apply
(dolist (df '("/" "/ssh::"))
the result is different:
default-directory "/":
read-file-name-default 1 2.028857143
2.028857143
completing-read 1 2.027307814
2.027307814
completion-file-name-table 21 1.8559938259
0.0883806583
tramp-handle-file-name-completion 5 1.8494828229
0.3698965646
tramp-sh-handle-file-name-all-completions 5 1.6944888230
0.3388977646
tramp-sh-handle-insert-directory 1 0.249578238
0.249578238
tramp-handle-substitute-in-file-name 99 0.1388792329
0.0014028205
tramp-sh-handle-file-exists-p 19 0.0999807120
0.0052621427
tramp-handle-file-remote-p 215 0.0976847259
0.0004543475
tramp-handle-access-file 1 0.085786647
0.085786647
tramp-sh-handle-file-truename 1 0.063882702
0.063882702
completion--sifn-requote 7 0.0597124679
0.0085303525
tramp-sh-handle-file-directory-p 31 0.058696891
0.0018934480
tramp-sh-handle-file-attributes 3 0.0531375599
0.01771252
tramp-handle-file-symlink-p 1 0.039325965
0.039325965
tramp-sh-handle-expand-file-name 290 0.0263228309
9.076...e-05
tramp-sh-handle-file-readable-p 1 0.021077876
0.021077876
read-file-name-internal 16 0.017477787
0.0010923616
tramp-sh-handle-get-remote-gid 2 0.017327098
0.008663549
completion--file-name-table 16 0.0172834540
0.0010802158
tramp-sh-handle-file-system-info 1 0.016847262
0.016847262
tramp-handle-file-name-case-insensitive-p 2 0.007683494
0.003841747
tramp-sh-handle-get-remote-uid 1 0.005441875
0.005441875
tramp-handle-file-name-directory 16 0.000245159
1.532...e-05
tramp-handle-file-name-nondirectory 12 0.000174825
1.456875e-05
tramp-handle-file-name-as-directory 8 0.0001712199
2.140...e-05
tramp-handle-directory-file-name 9 0.0001689049
1.876...e-05
default-directory "/ssh::":
read-file-name-default 1 4.651150554
4.651150554
tramp-sh-handle-expand-file-name 385 3.9462248850
0.0102499347
completing-read 1 0.74229688
0.74229688
completion-file-name-table 21 0.560581997
0.0266943808
tramp-handle-file-name-completion 5 0.555473934
0.1110947868
tramp-sh-handle-file-name-all-completions 5 0.446917913
0.0893835826
tramp-handle-substitute-in-file-name 184 0.2490209689
0.0013533748
tramp-sh-handle-file-directory-p 46 0.1196519650
0.0026011296
tramp-handle-file-remote-p 311 0.0924080879
0.0002971321
tramp-sh-handle-file-exists-p 21 0.07839409
0.0037330519
tramp-sh-handle-file-attributes 1 0.053689036
0.053689036
completion--sifn-requote 7 0.043218526
0.0061740751
read-file-name-internal 16 0.0354457760
0.0022153610
completion--file-name-table 16 0.0352692769
0.0022043298
tramp-sh-handle-get-remote-gid 1 0.029920249
0.029920249
tramp-handle-file-name-case-insensitive-p 4 0.017043275
0.0042608187
tramp-handle-file-name-directory 10 0.0001320850
1.320...e-05
tramp-handle-directory-file-name 5 0.000103661
2.073...e-05
tramp-handle-file-name-nondirectory 6 6.9132e-05
1.1522e-05
tramp-handle-file-name-as-directory 3 5.6996e-05
1.899...e-05
Enough figures to analyze next days ... I have no idea yet what's up.
Best regards, Michael.
- File path completions: strange speed discrepancy, JD Smith, 2021/09/17
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/18
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/18
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/18
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/18
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/18
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/19
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/19
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/19
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/19
- Re: File path completions: strange speed discrepancy,
Michael Albinus <=
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/20
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/20
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/21
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/21
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/21
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/21
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/22
- Re: File path completions: strange speed discrepancy, JD Smith, 2021/09/24
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/24
- Re: File path completions: strange speed discrepancy, Michael Albinus, 2021/09/22