Skip to content

Conversation

@marc-mabe
Copy link
Owner

(similar to #110)

This gives a nice good performance improvement not only on iterating an EnumMap and reduces complexity. It also makes the iterator immutable due to changes happening to a map on iterating.

But the following BC breaks will happen:

  • Generator::rewind() throws an exception as it's not supported after starting.
  • the iterator is no longer seekable (it was seekable before via SeekableIterator)
  • implements IteratorAggregate (instead of SeekableIterator)

Bench:

+--------------+-----------------------------+--------+--------+------+----------------+--------------------+
| benchmark    | subject                     | groups | params | revs | tag:4.x:mean   | tag:generator:mean |
+--------------+-----------------------------+--------+--------+------+----------------+--------------------+
| EnumMapBench | benchGetKeysEmpty           |        | []     | 2000 | 0.339μs        | 0.348μs            |
| EnumMapBench | benchGetKeysFull            |        | []     | 2000 | 19.542μs       | 19.875μs           |
| EnumMapBench | benchGetValuesEmpty         |        | []     | 2000 | 0.069μs        | 0.069μs            |
| EnumMapBench | benchGetValuesFull          |        | []     | 2000 | 0.073μs        | 0.072μs            |
| EnumMapBench | benchSearchTypeJuggling     |        | []     | 2000 | 1.393μs        | 1.396μs            |
| EnumMapBench | benchSearchStrict           |        | []     | 2000 | 0.596μs        | 0.595μs            |
| EnumMapBench | benchOffsetSetEnumerator    |        | []     | 2000 | 18.454μs       | 16.123μs           |
| EnumMapBench | benchOffsetSetValue         |        | []     | 2000 | 44.485μs       | 41.045μs           |
| EnumMapBench | benchOffsetUnsetEnumerator  |        | []     | 2000 | 16.805μs       | 16.715μs           |
| EnumMapBench | benchOffsetUnsetValue       |        | []     | 2000 | 42.035μs       | 41.196μs           |
| EnumMapBench | benchOffsetExistsEnumerator |        | []     | 2000 | 16.373μs       | 16.304μs           |
| EnumMapBench | benchOffsetExistsValue      |        | []     | 2000 | 41.441μs       | 41.417μs           |
| EnumMapBench | benchContainsEnumerator     |        | []     | 2000 | 17.204μs       | 16.681μs           |
| EnumMapBench | benchContainsValue          |        | []     | 2000 | 43.013μs       | 42.603μs           |
| EnumMapBench | benchIterateFull            |        | []     | 2000 | 48.067μs       | 30.821μs           |
| EnumMapBench | benchIterateEmpty           |        | []     | 2000 | 0.195μs        | 0.252μs            |
| EnumMapBench | benchCountFull              |        | []     | 2000 | 0.063μs        | 0.063μs            |
| EnumMapBench | benchCountEmpty             |        | []     | 2000 | 0.061μs        | 0.061μs            |
+--------------+-----------------------------+--------+--------+------+----------------+--------------------+

@prolic ping

@marc-mabe marc-mabe merged commit b71b4ab into 4.x Mar 11, 2019
@marc-mabe marc-mabe deleted the EnumMap-IteratorAggregate-Generator branch March 16, 2019 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants