So, something like this then:
--- /dev/null +++ Tools.pmod/Shoot.pmod/ArrayCopy.pike 2010-07-08 13:21:47.908766180 +0200 @@ -0,0 +1,17 @@ +#pike __REAL_VERSION__ +inherit Tools.Shoot.Test; + +constant name="Array Copy"; + +void perform() +{ + int dummy; + for (int i = 0; i < 100000; i++) + dummy += arraycopy(); +} + +int arraycopy() +{ + array arg = ({ "a", "b", "c" }); + return sizeof(arg); +}
--- /dev/null +++ Tools.pmod/Shoot.pmod/ArrayZero.pike 2010-07-08 13:16:35.179720588 +0200 @@ -0,0 +1,17 @@ +#pike __REAL_VERSION__ +inherit Tools.Shoot.Test; + +constant name="Array Zero"; + +void perform() +{ + int dummy; + for (int i = 0; i < 100000; i++) + dummy += arrayzero(); +} + +int arrayzero() +{ + array arg = allocate(4711); + return sizeof(arg); +}
Feel free to add the rest of your test to the Shootout before adding the optimizations so Pikefarm can track how the diffrent platforms react to it.
In general: If people have performance tests, add them to the benchmark. It's immensly helpful to track regressions and is only run by Pikefarm, so you do not risk breaking anything important by checking in all kinds of experimental stuff there.