Skip to content

Instantly share code, notes, and snippets.

@RichardEllicott
Last active November 28, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardEllicott/0e7fd7581fe7942e58bfa4e7c303fc60 to your computer and use it in GitHub Desktop.
Save RichardEllicott/0e7fd7581fe7942e58bfa4e7c303fc60 to your computer and use it in GitHub Desktop.
func _ready():
var test_iterations = 1000000
print("start tests...")
var dispose # i put this here, to prevent some clever compiler from realising these values are not used
var counter = test_iterations
var start_time = OS.get_ticks_msec()
while counter > 0: #replaced with while as this wouldn't allocate any memory
dispose = 15629/counter
counter -= 1
var total_time = OS.get_ticks_msec() - start_time
print('interger division time: ', total_time)
yield(get_tree().create_timer(5.0), "timeout") # rest for a bit!
counter = test_iterations
start_time = OS.get_ticks_msec()
while counter > 0:
dispose = 15629.0/counter
counter -= 1
total_time = OS.get_ticks_msec() - start_time
print('float division time:: ', total_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment