What might cause a WPF application to be noticeably slower when launched from a search than it is when clicking the start menu shortcut?

Richard J Foster 0 Reputation points
2023-05-23T14:39:47.0633333+00:00

I have a scenario that I can't explain. I've recently been working on some performance improvements to a moderately complex WPF application running under .NET 4.7.2, and had made some significant headway until I went to test the built version.

After installation, I launched the app in the way many of our customers launch it: I typed the name of the product into the Windows 11 Enterprise (build 22624.1755) search bar, then clicked on the "Best Match" result which appeared to be the shortcut to our application. Performance of the application seemed generally worse than expected, and when I went to the area I had recently optimized the application kept going unresponsive.

Assuming I had messed up in some way, I launched a profiler (JetBrains dotTrace) to see where the performance issue lay. The application performed perfectly and did not show the "(Not Responding)" message in the title bar at any time.

Continuing my investigations, I discovered that launching the application directly (by navigating to the appropriate Program Files folder in Windows Explorer and double-clicking to launch the executable) also showed no performance issues. Neither did launching the application from a pinned shortcut in the Start menu. It was only the "Search" based and "recently used" launch paths that exhibited performance challenges. The behavior seems to be completely repeatable (at least over 10 attempts using each launch process).

What might be different about launching the application from a search result / recently used link that may cause the observed performance issues?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,784 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,926 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hui Liu-MSFT 48,571 Reputation points Microsoft Vendor
    2023-05-24T02:31:30.62+00:00

    Hi,@Richard J Foster. Welcome Microsoft Q&A.

    Launching an application from a search result or a recently used link can introduce some additional factors that may affect the performance of the application.

    Here are some possible reasons for the observed performance issues:

    Search indexing: When you launch an application from a search result, the operating system needs to perform indexing and search operations to find the appropriate shortcut or executable. This indexing process consumes system resources and may cause a temporary slowdown in the overall system performance.

    Disk I/O: Launching an application from a search result or a recently used link may involve accessing the storage device to retrieve the necessary files and data. If the storage device is busy with other I/O operations, such as background processes or disk fragmentation, it can result in slower loading times and overall performance degradation.

    Application startup process: The way an application is launched can affect its startup process. For example, launching an application from a search result or a recently used link may skip certain initialization steps or use different application startup configurations, which can impact the performance and behavior of the application.

    Environment variables or runtime settings: Launching an application from different locations or using different launch methods may set different environment variables or runtime settings. These variables and settings can influence how the application behaves and performs. It's possible that certain settings or configurations are affecting the performance when launching from a search result or a recently used link.

    To investigate further and identify the specific cause of the performance issues, you could try the following steps:

    Monitor system resource usage: Use task manager or performance monitoring tools to observe CPU, memory, and disk usage when launching the application from different sources. This can help identify if there are any significant differences in resource consumption.

    Analyze startup process: Use profiling tools or debug logs to analyze the application's startup process. Look for any variations in initialization steps or configuration settings when launching from different sources. This can provide insights into potential differences that might impact performance.

    Check for dependencies or external factors: Review any dependencies or external factors that the application relies on, such as network connections, external services, or data sources. Ensure that these dependencies are consistent and accessible regardless of the launch method.

    Hope this is helpful for you.

    Best Regards,

    Hui


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.