Sign in to follow this  
Followers 0
Wb-FreeKill

Optimize my script.. its running slow

7 posts in this topic

Well, ive been working on a program the last cuple of weeks, mosly just for the learning and understanding... and its finaly comming to an end. Its a 1500 line compact script, with LOTS of buttons and other stuff, and it uses about 30 % cpu time with a "sleep (20)" in the while, to slow it down :D

I will NOT post my program here, as it's personal.. but i would like to have someone who may know how to optimize it, to take a look at it, and maybe found a solution!

If someone has an interest of looking at it, and see what the problem, if their is any, then tell me and i could send you the program. I will only give it to one person that i can trust... so.. anyone? :)

Share this post


Link to post
Share on other sites

do you trust me?


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

do you trust me?

<{POST_SNAPBACK}>

Not nesseseraly, would you trust yourself?

Share this post


Link to post
Share on other sites

in some cases no. in most cases probably.


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

in some cases no. in most cases probably.

<{POST_SNAPBACK}>

Well, i think ill just leave it to someone else, unless you are willing to do it?

Share this post


Link to post
Share on other sites

Well my suggestions:

1) Reduce the number of system calls, "talking" to the OS and Harddrives is much slower then accessing memory in you program

2) If you are indexing something alot $var[$i] then set a local to it and use the local. local $whatever = $var[$i], indexing is slower then using a regular variable

3) If you are looping thru to find a value, For $i=0 to 100000, and you find it, exit the loop

4) make sure you need to call something before calling it:

$m = MouseGetPos()
if $copymouse Then $ImportantX = $m[0]

is slower then:

if $copymouse Then
$m = MouseGetPos()
$ImportantXY = $m[0]
Endif

5) If its still in print, the O'Reilly book, High Performance Computing is a good read for optimizing your code for speed


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

well, it has alot of If... Then.. but i can't really sort something out..

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