-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement core benchmarks: StringName, NodePath, ConfigFile (#40)
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
extends Benchmark | ||
|
||
const NUM_VALUES := 1000 | ||
const ITERATIONS := 50 | ||
const CONFIG_FILE := "user://benchmark_config_file.ini" | ||
const CONFIG_FILE_ENCRYPTED := "user://benchmark_config_file.ini.encrypted" | ||
var config: ConfigFile = ConfigFile.new() | ||
|
||
func _init() -> void: | ||
create_config_file() | ||
config.save(CONFIG_FILE) | ||
config.save_encrypted_pass(CONFIG_FILE_ENCRYPTED, "PasswordIsGodot") | ||
|
||
|
||
func create_config_file() -> void: | ||
for i in 1000: | ||
config.set_value("Sec" + str(i % 10), "Key" + str(i), "Val" + str(i)) | ||
|
||
|
||
func benchmark_save() -> void: | ||
for i in ITERATIONS: | ||
config.save(CONFIG_FILE) | ||
|
||
|
||
func benchmark_load() -> void: | ||
for i in ITERATIONS: | ||
config.load(CONFIG_FILE) | ||
|
||
|
||
func benchmark_save_with_password() -> void: | ||
for i in ITERATIONS: | ||
config.save_encrypted_pass(CONFIG_FILE_ENCRYPTED, "PasswordIsGodot") | ||
|
||
|
||
func benchmark_load_with_password() -> void: | ||
for i in ITERATIONS: | ||
config.load_encrypted_pass(CONFIG_FILE_ENCRYPTED, "PasswordIsGodot") | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends Benchmark | ||
|
||
const ITERATIONS = 1_000_000 | ||
|
||
func benchmark_create() -> void: | ||
for i in ITERATIONS: | ||
var _n: NodePath = "Godot" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends Benchmark | ||
|
||
const ITERATIONS = 1_000_000 | ||
|
||
func benchmark_create() -> void: | ||
for i in ITERATIONS: | ||
var _s: StringName = "Godot" |