this
health_hud.icon_state = "[src.hp]" // hp is a num var
or this?
health_hud.icon_state = num2text(src.hp)
thanks.
ID:151273
Nov 30 2011, 2:58 am
|
|
what way is better to convert num 2 text in this case?
this health_hud.icon_state = "[src.hp]" // hp is a num var or this? health_hud.icon_state = num2text(src.hp) thanks. |
In response to Forum_account
|
|
thanks a lot. :)
|
Still, you can write a simple program to test this and see if there's a huge difference:
Compile the program, run it, and profile it (click on the DS window's icon, go to "Server", then "Profile..."). Click each verb a few times then click the "Refresh" button and compare the times.
When I ran it, num2text was slightly better: the test2() verb took 0.883 seconds for 10 calls, test1 took 0.908 seconds for 10 calls. This means you can do "[n]" 110,000 times per second and num2text(n) 113,000 times per second. Considering you'll probably be calling these things 10-100 times per second, this is such a small fraction of your game's CPU usage that it doesn't really make a difference.