Bug 440766 - Service menu actions are very slow when used with large numbers of files
Summary: Service menu actions are very slow when used with large numbers of files
Status: REPORTED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 21.04.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-09 05:34 UTC by cvnnxs
Modified: 2021-08-19 09:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Bash script to be used as a service action to demonstrate the issue (35 bytes, application/x-shellscript)
2021-08-09 05:34 UTC, cvnnxs
Details
Desktop file to be used with the test script (267 bytes, application/x-desktop)
2021-08-09 05:36 UTC, cvnnxs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cvnnxs 2021-08-09 05:34:56 UTC
Created attachment 140595 [details]
Bash script to be used as a service action to demonstrate the issue

SUMMARY

Using a service menu in Dolphin's context menu to perform an action on a fairly large number of selected files is very slow, regardless of the size of the files or the action to be performed. The time increases as the number of selected files does, becoming quite noticeable at about 25 files, with about a 5 second delay at that point before the action is executed. I have observed this with both my own custom service menus as well as built-in service menus, such as the "Compress" menu. This behavior occurs when using either %F or %U in the desktop file to pass the selection to the script.

STEPS TO REPRODUCE
1. Navigate to a folder with a substantial number of files
2. Select a number of files
3. Right-click on the selection, and execute an action from a service menu

OBSERVED RESULT
There is a significant delay before any action is executed; for example, a test service (attached) that does nothing but open a kdialog takes roughly 9 seconds to execute on a selection of about 75 small text files.

EXPECTED RESULT
When running the same test script from Nautilus/Files scripts context menu on the same selection of files, the kdialog box appears almost instantly. I would expect Dolphin's performance to be at least comparable.

SOFTWARE/OS VERSIONS
Fedora 34
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Comment 1 cvnnxs 2021-08-09 05:36:07 UTC
Created attachment 140596 [details]
Desktop file to be used with the test script
Comment 2 cvnnxs 2021-08-19 09:40:16 UTC
Upon further investigation, it appears that when passing the files to the service menu action, kactivitymanagerd writes a .desktop entry for each file in ~/.local/share/RecentDocuments. Only when it has done this for every selected file is the action then executed.