Kantu gets slower and slower the longer the script is running


#1

Hello, I’ve been using Kantu for a while and I was really happy when the IPC bug has been solved, because I was finally able to run scripts without worrying that they will hang, however, recently I have discovered another huge issue.
It seems that whenever you run the script and leave it for an hour or more - it gets super slow, up to 10 times slower than it is on the initial start. I’ve created a simple performance script that clearly shows the issue:

{
  "CreationDate": "2018-10-28",
  "Commands": [
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed"
    },
    {
      "Command": "store",
      "Target": "Iteration",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "Speed in seconds",
      "Value": "!csvLine"
    },
    {
      "Command": "csvSave",
      "Target": "performance_test",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "0",
      "Value": "i"
    },
    {
      "Command": "store",
      "Target": "10000",
      "Value": "j"
    },
    {
      "Command": "label",
      "Target": "START",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "Date.now()",
      "Value": "start"
    },
    {
      "Command": "storeEval",
      "Target": "${i}+1",
      "Value": "i"
    },
    {
      "Command": "storeEval",
      "Target": "(Date.now()-${start})/1000",
      "Value": "end"
    },
    {
      "Command": "store",
      "Target": "${i}",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "${end}",
      "Value": "!csvLine"
    },
    {
      "Command": "csvSave",
      "Target": "performance_test",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Run time - ${end}s",
      "Value": "red"
    },
    {
      "Command": "gotoIf",
      "Target": "${i} < ${j}",
      "Value": "START"
    }
  ]
}

Just leave it until it times out (15min), then open the “performance_test.csv” file and check the initial speed values and then compare with the values in the end of the script.

In my case, the average speed for the first 100 iterations was 0.324s, while the average speed for the last 100 iterations was 0.551s, which is 70% slower than it was in the beginning JUST AFTER 15 MINUTES OF RUNTIME . So you can only imagine what happens when you leave the script for an hour or longer.

I really hope that this data will help you to fix this issue as soon as possible and also thank you so much for your great work on creating one of the best automation tools currently available. :+1:


#2

Thanks, I confirmed the issue and we will be working on this.

As workaround, can you use the command line to start the macro, and then close Chrome again after e. g. 100 loops, and restart it? The command line has the close paramter. That should avoid the slowness issue.

If you can not use the command line for any reason, I would be interested to learn why :wink:


#3

Thanks for the cmd macros suggestion, I will probably need to spend the whole day rewriting my scripts, but I may give it a try as a temporary solution. :smiley:


#4

6 posts were split to a new topic: Command line close=1: Do not close browser when user (manually) stops macro


#5

Just to add to my last post: Here is a sample Powershell script that shows how to

Of course, the same can be done in C#, Node.JS, Python, Ruby, VBS or any other scripting or programming language.


#6

Thanks, @admin ! The problem is that every time the chrome tabs are being reopened, they must have the different URL which I find difficult to implement as I cannot change the macro file. The only solution I found is to each time write that variable into csv file and then read it from there. But all this process still slows down the whole procedure, so I really hope that you will soon be able to find and fix the bug that causes the scripts to slow down. I have applied to a beta testing, so if you need some help with this bug - then just let me know and I’ll do my best to make sure that you fix it as soon as possible.:heart: