1. Starting Guide

<< Click to Display Table of Contents >>

Navigation:  1. Starting Guides >

1. Starting Guide

1.5. Features and Hints

Previous Top Next


Starting Guide

 

Speed Considerations

Some general tips for using the Script language,

 

clip0513

 

Get a Speed Dump

 

Mostly speed is not an issue for our tasks. But sometimes it is, and then you will be quite happy with your robot.

Because he's really fast.  

 

If you want to see, how fast, this is your chapter.

 

How fast is the Robot?

On my Computer the Robot can process ~16.000.000 Cycles in one second.

Each command needs a certain amount of such Cycles. For example an Empty Line or a Commented-Line needs 1 Cycle.

A Line with a FOR.-Loop may need 51 Cycles (see below). A NEX. may need 26 Cycles.

 

The Speed Dump shows you how many Cycles each Command has needed.

 

 

We have just seen that we can easily measure, how long time a script needs from start to end.

But how much time does each line in the script need?

 

You can get the timing of each line of your code, using a speed-dump.

To get it, we will just add a single line to our code from above.

 

' Start our stop-watch

VAR.§§TIM=#dtime#

' Init counter variable

FOR.§§CNT|1|50

' Print the actual number

  PRT.§§CNT

NEX.

' Get the time how long we needed.

VAR.§§TIM=#dsince#

' This is the Speed Dump.

DMP.

' We need this kine, or else the Speed Dump will immediately disappear!

MBX.§§TIM

ENR.

 

In the picture below is the resulting speed dump i get here on my system. Let us take a close look on what all these numbers mean.

 

On the Left side you see the Line-Number. This Line number is not always identical with the Line number in the Editor. While in most cases the line numbers are identical, however if you have expanded Macros, they will not be identical.

 

Next is a large number with a lot of zero's. That is the CPU "cycle counter".

This is not in seconds or milliseconds, its the amount of work the CPU had to do with your statement.

 

How much is it in seconds?

On my Computer the Robot can process ~16.000.000 Cycles in one second.

But anyway, the higher the number - the longer it takes!

 

Next comes the "Line execution counter" a field that shows you, how often a line was executed.

As our loop was from 1 to 50, all lines inside the loop were executed 50 times. Thats why there is a 50 in that field.

 

Lastly you can see the code of that line.

 

graphic

 

Does it only count to 9999 ?

No, it doesn't.

As you can see, the code execution counter shows only 4 zeroes. What will it do above 9999?

The answer is: It will just continue counting.

 

How fast is this?

But, how long does it take to count to ... for example 100200?

The answer is, it need just a bit more time then a second.

 

However you need to run the script as a compiled executable.

If it would be running in the editor, it would take too long time.

 

This is the script:

 

VAR.$$TIM=#dtime#

FOR.§§CNT|1|100200

  'PRT. §§CNT

NEX.

VAR.$$TIM=#dsince#

DMP.

MBX.Use time $$TIM

ENR.

 

And here is the result:

 

graphic

 

 

Maybe we should have called it "Speed Robot" because it is really fast. This speed will help you to use it even for tasks you have never thought about before.

 

Sort those 100.000 Names ... check Files for errors. Test applications and create Log-Files.

Whatever it is, your robot is ready to do it with you.

 

clip0514

 

One more word about speed

 

One of the key features of the "Speed Robot" is its optimized use of CPU caches, which significantly increases its speed and performance. CPU caches are small, fast memory banks that store frequently used data, allowing the CPU to access it quickly. By utilizing these caches, the Speed Robot can access the data it needs more efficiently, resulting in faster execution times.

 

However, it is important to note that the initial execution of a command may be slower compared to successive calls of the same command. This is because the code needs to be loaded into the CPU cache for the first time, and potentially out of Windows virtual memory. Once the code is loaded into the cache, subsequent calls to the same command can be executed more quickly.

 

This optimization is especially beneficial for tasks that need to be performed repeatedly, such as processing large amounts of data. The more times the task is repeated, the more the robot's speed accelerates, making it an ideal tool for these types of tasks.

 

When testing the Speed Robot's performance, it's important to keep in mind that the best results will be achieved when the commands are already in the cache. This can be achieved by executing the commands once within the same script. This is because once the code is loaded into the cache, the CPU can access it more quickly, resulting in faster execution times.

 

In summary, the Speed Robot is optimized to use CPU caches, which increases its speed and performance. The initial execution of a command may be slower, but the robot's speed accelerates with each repetition, making it an ideal tool for tasks that need to be performed multiple times. To get the best results, make sure the commands are already in the cache by executing them once within the same script.

 

 

  See also

1.5.2 Using Variables

1.5.3 More about Variables

1.5.5 Global and Local Variables

1.5.6 Using the data stacks

1.5.7 Using Text-Strings

1.5.8 Basic String Operations

1.5.9. Organizing data items in blocks

1.6.1. Program Flow Control

1.6.2. Looping around

1.6.3 Flexible Loops

1.7. Application and PID

1.7.1 Applications and Threads

1.8. Selecting the Application (Topwindow)

1.8.1 The "Client" and the "Non-Client" Parts of a window

1.9. Locating Child-Windows