emacs-async icon indicating copy to clipboard operation
emacs-async copied to clipboard

Skip async for fast operations

Open darkfeline opened this issue 4 years ago • 6 comments
trafficstars

Starting an async process for fast operations is clunky, so add a new option/feature for skipping async if the operation is fast. Same device renames are fast (since it's just a directory entry change) and renames and copys of small files are fast (arbitrarily picking 5 MB as the cutoff for modern computers/disks, can be configured).

darkfeline avatar Aug 11 '21 05:08 darkfeline

darkfeline @.***> writes:

Starting an async process for fast operations is clunky, so add a new option/feature for skipping async if the operation is fast.

I agree it is fast to copy small files or rename on same disk but is it really worth the effort to switch to a sync copy for such cases, it is perhaps slower to run an async process for such files, but how much do you win by running sync? Note also that if you use helm, C-u M-C/R switch to sync.

Thanks.

-- Thierry

thierryvolpiatto avatar Aug 11 '21 09:08 thierryvolpiatto

Renaming a file in the same directory using dired-async hangs for a good 2-4 seconds (specifically, any async operation that finishes too quickly). So this saves me 2-4 seconds each rename.

I guess I always assumed that that's just how dired-async works (maybe it's waiting for a subprocess that already ended?), but maybe we should fix that bug instead? Assuming it is a bug and not WAI.

I don't use helm.

darkfeline avatar Aug 13 '21 04:08 darkfeline

darkfeline @.***> writes:

Renaming a file in the same directory using dired-async hangs for a good 2-4 seconds (specifically, any async operation that finishes too quickly).

Can't reproduce this, it is instant for me here.

-- Thierry

thierryvolpiatto avatar Aug 13 '21 08:08 thierryvolpiatto

Hm, this is going to be one of those tricky bugs to reproduce. I have a hunch it has to do with having NFS mounted buffers open.

darkfeline avatar Aug 23 '21 06:08 darkfeline

For me there is also a delay with async that I don't experience with the built in renaming/copying in dired. I just added this code to my init to toggle between enabling and disabling async:

;; Async toggle
(defun vk-toggle-async ()
  "Toggle enabling and disabling async"
  (interactive)
  (if (eq dired-async-mode nil)
      (progn
        (call-interactively 'dired-async-mode)
        (message "Async enabled"))
    (progn
      (progn
        (call-interactively 'dired-async-mode)
        (message "Async disabled"))
    )))

vnckppl avatar Mar 03 '22 02:03 vnckppl

What about M-x dired-async-mode? ;-)

thierryvolpiatto avatar Mar 03 '22 07:03 thierryvolpiatto

darkfeline @.***> writes: Renaming a file in the same directory using dired-async hangs for a good 2-4 seconds (specifically, any async operation that finishes too quickly). Can't reproduce this, it is instant for me here.

I can reproduce this with 100 % accuracy, but I have old drives (not SSD). My machine has pretty bad performance characteristics in general. Not sure what other details to give.

In any case, I'd appreciate if this was merged.

skangas avatar Aug 19 '22 12:08 skangas

Ok merged.

thierryvolpiatto avatar Aug 19 '22 15:08 thierryvolpiatto

Thanks!

skangas avatar Aug 19 '22 15:08 skangas