From 30c1e9e48c1acff2a11a2a5961c967e15c7f2e79 Mon Sep 17 00:00:00 2001 From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org> Date: Wed, 29 Jan 2003 08:45:20 +0100 Subject: [PATCH] tests for appending/inserting on mapping/multiset/array Rev: lib/modules/Tools.pmod/Shoot.pmod/AppendArray.pike:1.1 Rev: lib/modules/Tools.pmod/Shoot.pmod/AppendMapping.pike:1.1 Rev: lib/modules/Tools.pmod/Shoot.pmod/AppendMultiset.pike:1.1 --- .../Tools.pmod/Shoot.pmod/AppendArray.pike | 22 ++++++++++++++++++ .../Tools.pmod/Shoot.pmod/AppendMapping.pike | 23 +++++++++++++++++++ .../Tools.pmod/Shoot.pmod/AppendMultiset.pike | 23 +++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 lib/modules/Tools.pmod/Shoot.pmod/AppendArray.pike create mode 100644 lib/modules/Tools.pmod/Shoot.pmod/AppendMapping.pike create mode 100644 lib/modules/Tools.pmod/Shoot.pmod/AppendMultiset.pike diff --git a/lib/modules/Tools.pmod/Shoot.pmod/AppendArray.pike b/lib/modules/Tools.pmod/Shoot.pmod/AppendArray.pike new file mode 100644 index 0000000000..b4519361f3 --- /dev/null +++ b/lib/modules/Tools.pmod/Shoot.pmod/AppendArray.pike @@ -0,0 +1,22 @@ +inherit Tools.Shoot.Test; + +constant name="Append array"; + +int k = 5; /* variable to tune the time of the test */ +int m = 100000; /* the target size of the array */ +int n = m*k; // for reporting + +void perform() +{ + for (int i=0; i<k; i++) + { + array v=({}); + for (int j=0; j<m; j++) + v+=({42}); + } +} + +string present_n(int ntot,int nruns,float tseconds,float useconds,int memusage) +{ + return sprintf("%.0f/s",ntot/useconds); +} diff --git a/lib/modules/Tools.pmod/Shoot.pmod/AppendMapping.pike b/lib/modules/Tools.pmod/Shoot.pmod/AppendMapping.pike new file mode 100644 index 0000000000..dda9fe5eb7 --- /dev/null +++ b/lib/modules/Tools.pmod/Shoot.pmod/AppendMapping.pike @@ -0,0 +1,23 @@ +inherit Tools.Shoot.Test; + +constant name="Append mapping"; + +int k = 5; /* variable to tune the time of the test */ +int m = 100000; /* the target size of the mapping */ +int n = m*k; // for reporting + +void perform() +{ + for (int i=0; i<k; i++) + { + mapping v=([]); + int z=i*m+m; + for (int j=i*m; j<z; j++) + v[j]=42; + } +} + +string present_n(int ntot,int nruns,float tseconds,float useconds,int memusage) +{ + return sprintf("%.0f/s",ntot/useconds); +} diff --git a/lib/modules/Tools.pmod/Shoot.pmod/AppendMultiset.pike b/lib/modules/Tools.pmod/Shoot.pmod/AppendMultiset.pike new file mode 100644 index 0000000000..c0aa838d86 --- /dev/null +++ b/lib/modules/Tools.pmod/Shoot.pmod/AppendMultiset.pike @@ -0,0 +1,23 @@ +inherit Tools.Shoot.Test; + +constant name="Append multiset"; + +int k = 5; /* variable to tune the time of the test */ +int m = 100000; /* the target size of the multiset */ +int n = m*k; // for reporting + +void perform() +{ + for (int i=0; i<k; i++) + { + multiset v=(<>); + int z=i*m+m; + for (int j=i*m; j<z; j++) + v[j]=42; + } +} + +string present_n(int ntot,int nruns,float tseconds,float useconds,int memusage) +{ + return sprintf("%.0f/s",ntot/useconds); +} -- GitLab