Page 1 of 1
Run speed of a script: how to test
Posted: 2017-10-30 09:25:11
by fulvio53s03
I have a script that has slowdowns running but I can not figure out if it is a connection problem or a code problem in the script itself.
How can I measure the duration of the various script functions?
Any suggestion?

Posted: 2017-10-31 17:31:18
by antp
You can save the pages of the site (those that the script will access, e.g. search results on a certain title and the movie page itself) to your computer and load them from disk rather than the web.
For loading them from disk, you put in comment the GetPage calls and instead call a GetLocalPage function:
Code: Select all
function GetLocalPage(Filename: string): string;
var
Page: TStringList;
begin
Page := TStringList.Create;
Page.LoadFromFile('c:\whereever you saved the files\' + Filename);
Result := Page.Text;
Page.Free;
end;
Posted: 2017-11-01 06:24:33
by fulvio53s03
Thanks!
This could be a good idea (and maybe it could help in security problems with wikipedia, too ?!?!).

Posted: 2017-11-01 08:16:42
by antp

I don't see how it could help with Wikipedia, except if each time you save the page in your web browser before importing it via script, but then it is easier to copy/paste info directly from the site.
Posted: 2017-11-01 08:33:42
by fulvio53s03
antp wrote:
I don't see how it could help with Wikipedia, except if each time you save the page in your web browser before importing it via script, but then it is easier to copy/paste info directly from the site.
I think it could be fastest to copy every page I need into a folder in my computer, then extract info from them.
I need a lot of copy/paste To fill every field in AMC while wikipedia.it can be even used in batch mode.....
As i said, I hope your suggestion can be useful....
