Skip to content
Snippets Groups Projects
Commit 30c1e9e4 authored by Mirar (Pontus Hagland)'s avatar Mirar (Pontus Hagland)
Browse files

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
parent b6c8777e
No related branches found
No related tags found
No related merge requests found
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);
}
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);
}
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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment