Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Cheat Engine Forum Index
PostGo back to topic
ParkourPenguin
I post too much
Reputation: 140
Joined: 06 Jul 2014
Posts: 4300

PostPosted: Tue Mar 21, 2017 10:30 am    Post subject:

Premature optimization is the root of all evil.

If the difference an optimization makes is inconsiderable, the time spent on that optimization was wasted and the complexity that optimization adds is unwarranted. If you are doing something in which creating a timer is a slow and/or costly operation, perhaps you should reconsider using Lua and instead use assembly.

The main problem is the side effects that come from the main thread executing that code in a loop. This freezes the GUI since CE can't respond to messages, but more importantly, the CPU is executing that code as fast as it possibly can. This is almost never required, and as such, your code will make the processor execute more cycles per second than if you had just used a timer.

There's more to programming than performance. Using higher-level abstractions (i.e. while loops and timers) allows you to write safer, more usable, more readable, and/or more maintainable code faster than code using lower-level abstractions.

IMO using a timer wouldn't make a significant difference. If you don't use a timer, the GUI hangs and the CPU is less efficient in most cases, but I really don't care and I don't think most people would care either. It's just another way of doing things.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
++METHOS
Review: Approve
Post reference:
ReviewPosted: Tue Mar 21, 2017 12:49 pm


Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites