GitHub user logarithm opened a pull request: https://github.com/apache/samza/pull/221
SAMZA-1331: Optimize Snapshot class constructor In some of our workloads (where we need to gather samza metrics five times per minute) `SlidingTimeWindowReservoir.getSnapshot()` method takes up to 10% of processor time. Almost all of `getSnapshot` time is taken by Collections.sort method. So, the complexity of Snapshot constructor is O(NlogN) + iteration through passed values. This ticket asks to improve the performance of Snapshot constructor but keep the performance of all other methods at least on the same level. You can merge this pull request into a Git repository by running: $ git pull https://github.com/metamx/samza fix-snapshot Alternatively you can review and apply these changes as the patch at: https://github.com/apache/samza/pull/221.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #221 ---- commit fc8b5fbc5fdc2145c62f0770c2b204a4dbfb1e57 Author: Maksim Logvinenko <mlogvine...@gmail.com> Date: 2017-06-07T20:53:47Z Remove Collections.sort in Snapshot. Added sum and average methods for O(1) ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---