aboutsummaryrefslogtreecommitdiff
path: root/tests/benchmarks/map-iterator/pds.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-12-27 04:55:33 -0300
committerEuAndreh <eu@euandre.org>2024-12-27 04:55:33 -0300
commit2764d269764e5c34c0d94ea58a5544692762560d (patch)
treeb90c4bf1b9905566c00f9a7436c2cc79f1c8d843 /tests/benchmarks/map-iterator/pds.go
parentAdd Makefile and move files to structured folders (diff)
downloadpds-2764d269764e5c34c0d94ea58a5544692762560d.tar.gz
pds-2764d269764e5c34c0d94ea58a5544692762560d.tar.xz
tests/pds.go: Move benchmarks and examples to separate test files
Diffstat (limited to 'tests/benchmarks/map-iterator/pds.go')
-rw-r--r--tests/benchmarks/map-iterator/pds.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/benchmarks/map-iterator/pds.go b/tests/benchmarks/map-iterator/pds.go
new file mode 100644
index 0000000..adef8a9
--- /dev/null
+++ b/tests/benchmarks/map-iterator/pds.go
@@ -0,0 +1,29 @@
+package pds
+
+import (
+ "flag"
+)
+
+
+
+var nFlag = flag.Int(
+ "n",
+ 1_000,
+ "The number of iterations to execute",
+)
+
+func MainTest() {
+ flag.Parse()
+ n := *nFlag
+
+ m := NewMap[int, int](nil)
+ for i := 0; i < n; i++ {
+ m = m.Set(i, i)
+ }
+
+ itr := m.Iterator()
+ itr.First()
+ for i := 0; i < n; i++ {
+ itr.Next()
+ }
+}