Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Core benchmarks #40

Merged
merged 3 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions benchmarks/core/config_file.gd
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")

7 changes: 7 additions & 0 deletions benchmarks/core/node_path.gd
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"
7 changes: 7 additions & 0 deletions benchmarks/core/string_name.gd
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"