Disable/EnableLineHook()

Discuss any general programming issues here
Post Reply
zylesea
Posts: 227
Joined: Tue Feb 16, 2010 12:50 am
Location: Westfalen/Germany
Contact:

Disable/EnableLineHook()

Post by zylesea »

Well, to increase speed I just played a very little bit with Enable/DisableLineHook

But I am not sure if I use it correctly. To my understanding it is actually sufficient to just be able to call the Linehook a few times a second, hence for a program that runs with a certain interval it would be enough to do this:

Code: Select all

Function p_main()
    DisableLineHook()     
    p_myListOfAlwaysInteratedFunctions()
    (...)
    EnableLineHook() 
EndFunction
SetInterval(0, p_main, 125); 8Hz  
Program gets significantly faster (in case of my tested program about half the cpu load of before), but I think it's rater a bold method, just disabling the linehook for almost the entire program and enable it only once each iteration. Is that a proper and easy way or is that pretty bad style and will lead to some unwanted side effect (the display and program stays responsive with that approach in my first test though).
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Disable/EnableLineHook()

Post by airsoftsoftwair »

As long as you make sure that the line hook gets called maybe 10 times per second there shouldn't be any problems unless your playing videos.
Post Reply