Loop Processing Time - Activity vs Code

I’ve noticed a couple of times that UiPath takes significantly longer to process a loop through the activities vs code. For example, the following For Each Row activity processes about 1,500 rows per second.

image

The following VB.Net processes 100,000+ rows in less than a second:

For Each rw In in_DT.Rows

     r = dtOut.NewRow()

	 r(0) =rw(0).ToString
	 r(1) = rw(1).ToString
	 r(2) =rw(2).ToString

	dtOut.Rows.Add(r)

Next rw

Are UiPath activities much slower because the activity is created and destroyed with each loop?

Speaking very generally, many activities are robust in that you can provide a variety of inputs that may require different ways of interpreting the data. When you write code directly, you’re writing specifically what you want to do, and the bot will do exactly that regardless of what happens. Simplification can lead to efficiency.

Take for example the Read Range activity for Excel. The process has to figure out where the data begins and ends if you don’t specify the range. However, if you write something to get a very specific range from an Excel workbook and do it with only VB.Net code, it will likely run faster, since calculations aren’t needed.

That said, activities make the workflow much easier to read and are meant to speed up programming and debugging.

1 Like

Hi,
Thank you for your suggestion. I added it to our internal ideas tracker for our team to consider.