Jump to content

Recommended Posts

Posted (edited)

I finished making a script to get element object information from various table columns with _INetGetSource and _StringBetween and StringRegExp. I put timers around my script and found out that _INetGetSource is the source of the slow downs. Could using IE udf be a lot leaner and faster?  Are there other ways that might be faster?

 

Edit: After some more forum searching and testing with IE.au3 library, I found that _IEBodyReadHTML and _IEDocReadHTML doesn't work unless you literally have an IE window open and loaded with the URL you want. I feel like that would take longer than _INetGetSource. I did read the difference between the 3 functions on another thread where Dale posted his explanation. Am I right about _IEBodyReadHTML and _IEDocReadHTML ? That it doesn't retrieve the sources unless you literally have an IE window open?

Edited by element72
Posted (edited)
  On 10/2/2015 at 2:02 AM, element72 said:

Could using IE udf be a lot leaner and faster?

No - it would be much slower. InetRead (which is used by _InetGetSource) retrieve only the source html-code of the requested page and leave it as is. The IE instead reads the source and look for additional content like images, css-files, javascript-files etc. and also loads this content. After that it renders all the stuff. So it has a lot more to load and work and so it can't be faster than a simple InetRead for getting the source code.

For demonstration a small speed comparison:

#include <IE.au3>

Global Const $N = 5
Global Const $s_URL = "https://www.whitehouse.gov/"


#Region get source code with InetRead
$iT = TimerInit()
For $i = 1 To $N
    $s_Source = BinaryToString(InetRead($s_URL, 1))
Next
$iT = TimerDiff($iT)
ConsoleWrite(StringFormat("% 20s: %8.3f ms\n", "InetRead", $iT / $N))
#EndRegion

#Region get source-code with IE
Global $oIE = _IECreate("about:blank", 0, 0, 0, 0)
$iT = TimerInit()
For $i = 1 To $N
    _IENavigate($oIE, $s_URL)
    $s_Source = _IEDocReadHTML($oIE)
Next
$iT = TimerDiff($iT)
ConsoleWrite(StringFormat("% 20s: %8.3f ms\n", "IE", $iT / $N))
_IEQuit($oIE)
#EndRegion

 

 

Edited by AspirinJunkie
Posted

:offtopic:
I like the way you use StringFormat. :)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Getting more speed

1. Get a faster internet connection

2. Switch to a compiled language

3. Cut out all the layers of frameworks and go to barebone HTTP protocol
   http://odetocode.com/Articles/741.aspx

I assume INetGetsource is still based on com object winhttp services 

https://msdn.microsoft.com/en-us/library/windows/desktop/aa384109(v=vs.85).aspx

    Const $sURL = "https://www.whitehouse.gov/"
    $oWinHttp = ObjCreate("WinHttp.WinHttpRequest.5.1")
    $oWinHttp.Open("GET", $sURL, false)
    $oWinHttp.Send()
    consolewrtie($oWinHttp.ResponseText)
Posted
  On 10/2/2015 at 10:27 AM, junkew said:

3. Cut out all the layers of frameworks and go to barebone HTTP protocol
   http://odetocode.com/Articles/741.aspx

It looks like another interesting article to read.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 10/2/2015 at 11:59 AM, junkew said:

you should start on page 1 of the internet ;-)

You mean here:

http://info.cern.ch/ ??

 ;)

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...