Last active
November 28, 2019 16:12
-
-
Save RichardEllicott/0e7fd7581fe7942e58bfa4e7c303fc60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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