[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Cost of String Comparisons??
- From: sohyl siddiqui <sohyl_s@...>
- Date: Mon, 4 Apr 2005 05:35:42 -0700 (PDT)
We are using LUA for Game scripting in our engine. In the scripts we make heavy (about 50 - 70, every frame) use of string comparisons. The scripts are taking quite a bit of the processor, so we wanted to optimize them. My fellow developer suggested that maybe we should change all the string comparisons to number (integer) comparisons. But I had read on this list that in lua string comparisons are very cheap, since actually it is just a pointer comparison.
Just wanted to confirm this. In the scripts we make comparisons such as this:
if BOTA_STATE == "ATTACK" then
elseif BOTA_STATE == ""RUN" then
I am not very keen on changing the string comparison to integer comparisons since that will mean a lot of work for me that I do not have time for atleast for now. so what do you ppl suggest, should I change or if the performance hit of string comparisons is not that much I could just leave it for another time ?
Thanking in advance,
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!