如何提升UiPath性能?高性能活动推荐及需规避活动清单
Great question! Optimizing UiPath workflow performance is crucial for keeping your automations snappy, especially when dealing with large datasets or long-running processes. Let’s break this down into actionable tips, go-to activities for speed, and pitfalls to avoid.
1. General Tips to Boost UiPath Runtime Performance
- Stabilize your selectors: Avoid dynamic attributes like
idorclassNamethat change on page reload. Use stable identifiers likenameor staticxpathexpressions. If you must use dynamic elements, use wildcards (*) or regex to make selectors more resilient—this cuts down on failed element searches and retries. - Minimize element interactions: Every time UiPath interacts with a UI element (like clicking or typing), it takes time. Cache frequently used elements with
Cache Scopeor store them in a variable upfront instead of re-finding them multiple times. - Optimize data handling: For
DataTableoperations, use built-in activities likeFilter Data TableorSort Data Tableinstead of looping through every row manually. These activities are optimized under the hood and way faster than custom loops. - Leverage parallel processing: Use
Parallel For Eachfor tasks that don’t depend on each other (like processing multiple independent files). This splits the work across multiple threads and cuts down on total execution time. - Limit unnecessary logging: Too many
LogMessageactivities (especially at theInfoorDebuglevel) can slow down your workflow. Stick to logging only critical events (errors, warnings) in production. - Close unused applications: Use
Close ApplicationorKill Processto shut down apps you’re done with—this frees up system resources for your automation.
2. Activities That Improve Execution Speed
Here are the go-to activities to make your workflows run faster:
Parallel For Each: Perfect for processing collections (like lists of files, emails) where each item doesn’t rely on the previous one. It runs tasks in parallel, drastically reducing total runtime.Filter Data Table/Sort Data Table: These native activities handle DataTable operations way more efficiently than writing customFor Each Rowloops. They’re optimized to process data in bulk instead of row-by-row.Get Attribute/Get Text: Instead of usingFind Elementfollowed by extracting text/attributes, use these direct activities to grab what you need in one step. Saves the overhead of separate element lookup and extraction.Invoke Code: For complex logic (like heavy calculations or advanced DataTable manipulations), writing a snippet of C# or VB code inInvoke Codeis often faster than chaining multiple UiPath activities. It cuts down on the overhead of activity execution.Cache Scope: Wrap frequently accessed UI elements or data operations in this scope. It caches the results so UiPath doesn’t have to re-find elements or re-calculate values every time.Use Application/BrowserwithCache Elementsenabled: This option caches all elements in the application/browser session, so UiPath doesn’t re-locate them on every interaction. Game-changer for repetitive UI tasks.Write Range(batch Excel writes): Instead of looping through rows and usingType Intoto write to Excel, useWrite Rangeto dump an entire DataTable into Excel in one go. Way faster and less error-prone.
3. Activities to Avoid (or Use Sparingly)
These activities can slow down your workflow if overused—here’s what to watch out for:
For Each Row(with large DataTables): If you’re dealing with thousands of rows, looping through each one is extremely slow. Replace it withFilter Data Table,Invoke Code, or bulk operations whenever possible.- Frequent
Find Element/Find Elementscalls: Every time you use these, UiPath scans the UI to locate elements. If you need to access the same element multiple times, cache it in a variable or useCache Scopeinstead. Type Intofor bulk data entry: Typing into fields one-by-one is slow. For Excel, useWrite Range; for web forms, see if you can paste bulk data or use API calls instead of manual typing.- Unnecessary
Delayactivities: Instead of using fixedDelaytimes (like 5 seconds), use conditional waits likeWait Element VisibleorWait Element Enabled. These wait only as long as needed, avoiding wasted time. Excel Application Scopewhen not needed: If you’re just reading/writing data without needing to interact with the Excel UI, use the standaloneRead Range/Write Rangeactivities. They don’t spin up an Excel process, which saves resources.- Overusing
Attach Window/Attach Browser: If you’re already in aUse Application/Browserscope, you don’t need to re-attach the window every time. Stick to one scope per application session.
Remember, always test your optimizations! A change that speeds up one workflow might not work the same for another—balance performance with functionality to make sure your automation still does what it’s supposed to.
内容的提问来源于stack exchange,提问作者Suresh Chandrasekar




