Sign in to follow this  
Followers 0
molotofc

FF.au3 slowness

4 posts in this topic

#1 ·  Posted (edited)

It seems ff.au3 (or mozrepl I'm not sure which is causing it) is really slow.

For example, the below script:

_FFStart()
Send("^t^t^t^t^t")
; opens 5 new tabs

Send("^t^t^t^t^t") opens the 5 new tabs pretty much instantly, whereas:

_FFStart()
_FFTabAdd(default,true,false)
_FFTabAdd(default,true,false)
_FFTabAdd(default,true,false)
_FFTabAdd(default,true,false)
_FFTabAdd(default,true,false)
; opens 5 new tabs

is a lot slower, typically around 1.5 seconds between each new tab is created. I thought it may be the third option of _FFTabAdd which is $LoadWait but I've already set that as False as you can see.

I don't know what the delay is.

Here is the console output if I use _FFTabAdd:

__FFStartProcess: ""C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-window "about:blank"  "-repl 4242 "
_FFConnect: OS: WIN_2008R2 WIN32_NT 7601 Service Pack 1
_FFConnect: AutoIt: 3.3.12.0
_FFConnect: FF.au3: 0.6.0.1b-10
_FFConnect: IP: 127.0.0.1
_FFConnect: Port: 4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:  452
_FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
__FFSendJavaScripts: Sending functions to FireFox .......... done
_FFLoadWait: . loaded in 13ms
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: try{gBrowser.selectedTab = gBrowser.addTab('about:blank')}catch(e){'_FFCmd_Err';};
__FFRecv: [object XULElement] - {linkedBrowser: {...}, _tPos: 1, closing: false, label: "New Tab", visibleLabel: "New Tab", pinned: false, hidden: false, ...}
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: try{gBrowser.selectedTab = gBrowser.addTab('about:blank')}catch(e){'_FFCmd_Err';};
__FFRecv: [object XULElement] - {linkedBrowser: {...}, _tPos: 2, closing: false, label: "New Tab", visibleLabel: "New Tab", pinned: false, hidden: false, ...}
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: try{gBrowser.selectedTab = gBrowser.addTab('about:blank')}catch(e){'_FFCmd_Err';};
__FFRecv: [object XULElement] - {linkedBrowser: {...}, _tPos: 3, closing: false, label: "New Tab", visibleLabel: "New Tab", pinned: false, hidden: false, ...}
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: try{gBrowser.selectedTab = gBrowser.addTab('about:blank')}catch(e){'_FFCmd_Err';};
__FFRecv: [object XULElement] - {linkedBrowser: {...}, _tPos: 4, closing: false, label: "New Tab", visibleLabel: "New Tab", pinned: false, hidden: false, ...}
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: try{gBrowser.selectedTab = gBrowser.addTab('about:blank')}catch(e){'_FFCmd_Err';};
__FFRecv: [object XULElement] - {linkedBrowser: {...}, _tPos: 5, closing: false, label: "New Tab", visibleLabel: "New Tab", pinned: false, hidden: false, ...}
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
+>02:01:59 AutoIt3.exe ended.rc:0
+>02:01:59 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 11.98

and compare that to of the console output if using Send("^t^t^t^t^t"):

__FFStartProcess: ""C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-window "about:blank"  "-repl 4242 "
_FFConnect: OS: WIN_2008R2 WIN32_NT 7601 Service Pack 1
_FFConnect: AutoIt: 3.3.12.0
_FFConnect: FF.au3: 0.6.0.1b-10
_FFConnect: IP: 127.0.0.1
_FFConnect: Port: 4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:  448
_FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
__FFSendJavaScripts: Sending functions to FireFox .......... done
_FFLoadWait: . loaded in 16ms
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
+>02:02:32 AutoIt3.exe ended.rc:0
+>02:02:32 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 5.1

I can't use Send because it's a remote machine. Is there anything I can do by getting _FFTabAdd to perform at the speed it should?

Edited by molotofc

Share this post


Link to post
Share on other sites



There will inherently be additional overhead from the back and forth communication between your script, MozRepl and FireFox. You may want to try changing the second parameter of _FFTabAdd to False, since you probably don't need to select each tab as it is being added.

Looking at the internal operations of _FFTabAdd, there's a built-in 1 second delay each time it is successfully called, so it looks like that is where the bulk of the delay is coming from.

Share this post


Link to post
Share on other sites

I see. How am I able to remove this built in 1 second delay?

Share this post


Link to post
Share on other sites

You could create your own custom version of _FFTabAdd and use that instead. You could also try the following instead of _FFTabAdd:

_FFCmd("gBrowser.loadOneTab('about:blank',null,null,null,true)", 3000)

This should open a new tab without the additional overhead of _FFTabAdd.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0