marc-mabe / php-enum

Simple and fast implementation of enumerations with native PHP
BSD 3-Clause "New" or "Revised" License
464 stars 36 forks source link

#74 provide integer (or binary) based EnumSet #86

Closed marc-mabe closed 7 years ago

marc-mabe commented 7 years ago

see #74

marc-mabe commented 7 years ago

Did a benchmark (see #87) and the changes here doesn't look good:

this branch
+----------------+-----------------+--------+--------+------+-----+------------+---------+---------+---------+---------+---------+--------+----------+
| benchmark      | subject         | groups | params | revs | its | mem_peak   | best    | mean    | mode    | worst   | stdev   | rstdev | diff     |
+----------------+-----------------+--------+--------+------+-----+------------+---------+---------+---------+---------+---------+--------+----------+
| EnumSet66Bench | benchCountFull  |        | []     | 5000 | 50  | 1,089,824b | 0.592μs | 0.608μs | 0.606μs | 0.637μs | 0.011μs | 1.85%  | 0.00%    |
| EnumSet66Bench | benchCountEmpty |        | []     | 5000 | 50  | 1,089,824b | 0.592μs | 0.610μs | 0.606μs | 0.637μs | 0.012μs | 2.02%  | +0.26%   |
| EnumSet32Bench | benchCountFull  |        | []     | 5000 | 50  | 1,082,088b | 1.360μs | 1.395μs | 1.389μs | 1.462μs | 0.022μs | 1.59%  | +129.33% |
| EnumSet32Bench | benchCountEmpty |        | []     | 5000 | 50  | 1,082,088b | 1.359μs | 1.390μs | 1.384μs | 1.450μs | 0.017μs | 1.20%  | +128.49% |
+----------------+-----------------+--------+--------+------+-----+------------+---------+---------+---------+---------+---------+--------+----------+
current master
+----------------+-----------------+--------+--------+------+-----+------------+---------+---------+---------+---------+---------+--------+---------+
| benchmark      | subject         | groups | params | revs | its | mem_peak   | best    | mean    | mode    | worst   | stdev   | rstdev | diff    |
+----------------+-----------------+--------+--------+------+-----+------------+---------+---------+---------+---------+---------+--------+---------+
| EnumSet66Bench | benchCountFull  |        | []     | 5000 | 50  | 1,070,120b | 0.495μs | 0.511μs | 0.506μs | 0.536μs | 0.010μs | 2.02%  | +53.89% |
| EnumSet66Bench | benchCountEmpty |        | []     | 5000 | 50  | 1,070,120b | 0.497μs | 0.517μs | 0.506μs | 0.540μs | 0.012μs | 2.25%  | +55.76% |
| EnumSet32Bench | benchCountFull  |        | []     | 5000 | 50  | 1,062,384b | 0.321μs | 0.332μs | 0.329μs | 0.346μs | 0.007μs | 2.06%  | 0.00%   |
| EnumSet32Bench | benchCountEmpty |        | []     | 5000 | 50  | 1,062,384b | 0.321μs | 0.335μs | 0.330μs | 0.352μs | 0.009μs | 2.67%  | +1.02%  |
+----------------+-----------------+--------+--------+------+-----+------------+---------+---------+---------+---------+---------+--------+---------+

:(

marc-mabe commented 7 years ago

arg nothing to worry - I had a bug in my benchmarks - the PR is fixed now

marc-mabe commented 7 years ago

@prolic The PR is ready :)