{"action":"created","issue":{"url":"https://api.github.com/repos/google/cadvisor/issues/1246","repository_url":"https://api.github.com/repos/google/cadvisor","labels_url":"https://api.github.com/repos/google/cadvisor/issues/1246/labels{/name}","comments_url":"https://api.github.com/repos/google/cadvisor/issues/1246/comments","events_url":"https://api.github.com/repos/google/cadvisor/issues/1246/events","html_url":"https://github.com/google/cadvisor/pull/1246","id":151285521,"number":1246,"title":"Ring timed store","user":{"login":"timstclair","id":3272040,"avatar_url":"https://avatars.githubusercontent.com/u/3272040?v=3","gravatar_id":"","url":"https://api.github.com/users/timstclair","html_url":"https://github.com/timstclair","followers_url":"https://api.github.com/users/timstclair/followers","following_url":"https://api.github.com/users/timstclair/following{/other_user}","gists_url":"https://api.github.com/users/timstclair/gists{/gist_id}","starred_url":"https://api.github.com/users/timstclair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timstclair/subscriptions","organizations_url":"https://api.github.com/users/timstclair/orgs","repos_url":"https://api.github.com/users/timstclair/repos","events_url":"https://api.github.com/users/timstclair/events{/privacy}","received_events_url":"https://api.github.com/users/timstclair/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/cadvisor/labels/area/performance","name":"area/performance","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"jimmidyson","id":464659,"avatar_url":"https://avatars.githubusercontent.com/u/464659?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmidyson","html_url":"https://github.com/jimmidyson","followers_url":"https://api.github.com/users/jimmidyson/followers","following_url":"https://api.github.com/users/jimmidyson/following{/other_user}","gists_url":"https://api.github.com/users/jimmidyson/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmidyson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmidyson/subscriptions","organizations_url":"https://api.github.com/users/jimmidyson/orgs","repos_url":"https://api.github.com/users/jimmidyson/repos","events_url":"https://api.github.com/users/jimmidyson/events{/privacy}","received_events_url":"https://api.github.com/users/jimmidyson/received_events","type":"User","site_admin":false},"assignees":[{"login":"jimmidyson","id":464659,"avatar_url":"https://avatars.githubusercontent.com/u/464659?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmidyson","html_url":"https://github.com/jimmidyson","followers_url":"https://api.github.com/users/jimmidyson/followers","following_url":"https://api.github.com/users/jimmidyson/following{/other_user}","gists_url":"https://api.github.com/users/jimmidyson/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmidyson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmidyson/subscriptions","organizations_url":"https://api.github.com/users/jimmidyson/orgs","repos_url":"https://api.github.com/users/jimmidyson/repos","events_url":"https://api.github.com/users/jimmidyson/events{/privacy}","received_events_url":"https://api.github.com/users/jimmidyson/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-04-27T02:39:05Z","updated_at":"2016-07-01T01:09:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/google/cadvisor/pulls/1246","html_url":"https://github.com/google/cadvisor/pull/1246","diff_url":"https://github.com/google/cadvisor/pull/1246.diff","patch_url":"https://github.com/google/cadvisor/pull/1246.patch"},"body":"I'm not sure the additional complexity is worth the performance gains, but here is an implementation of TimedStore using a ring buffer. I couldn't find a decent library for this, but let me know if there is one I missed.\r\n\r\nBenchmarks:\r\n```\r\nIters = 10000\r\nLimit = 10\r\n\r\nBenchmarkSliceAddSizeLimit-12      \t     500\t   2529468 ns/op\r\nBenchmarkRingAddSizeLimit-12       \t    1000\t   2053455 ns/op\r\nBenchmarkSliceAddAgeLimit-12       \t    1000\t   2440000 ns/op\r\nBenchmarkRingAddAgeLimit-12        \t    1000\t   2024899 ns/op\r\nBenchmarkSliceAddRandom-12         \t     300\t   4127581 ns/op\r\nBenchmarkRingAddRandom-12          \t     500\t   2988560 ns/op\r\n\r\n\r\nIters = 10000\r\nLimit = 100\r\n\r\nBenchmarkSliceAddSizeLimit-12      \t     500\t   2545626 ns/op\r\nBenchmarkRingAddSizeLimit-12       \t    1000\t   2332148 ns/op\r\nBenchmarkSliceAddAgeLimit-12       \t     500\t   2438340 ns/op\r\nBenchmarkRingAddAgeLimit-12        \t    1000\t   2320046 ns/op\r\nBenchmarkSliceAddRandom-12         \t     300\t   5750130 ns/op\r\nBenchmarkRingAddRandom-12          \t     500\t   3555849 ns/op\r\n\r\nIters = 10000\r\nLimit = 1000\r\n\r\nBenchmarkSliceAddSizeLimit-12      \t     500\t   2707495 ns/op\r\nBenchmarkRingAddSizeLimit-12       \t     500\t   2563681 ns/op\r\nBenchmarkSliceAddAgeLimit-12       \t     500\t   2704203 ns/op\r\nBenchmarkRingAddAgeLimit-12        \t     500\t   2529219 ns/op\r\nBenchmarkSliceAddRandom-12         \t     100\t  21935956 ns/op\r\nBenchmarkRingAddRandom-12          \t     300\t   4272770 ns/op\r\n\r\nIters = 10000\r\nLimit = none\r\n\r\nBenchmarkSliceAddRandomUnlimited-12\t      10\t1592485215 ns/op\r\nBenchmarkRingAddRandomUnlimited-12 \t     200\t  11563374 ns/op\r\n```\r\n\r\nThe ring buffer performs significantly better in the Unlimited case, but the gains in the limited case are diminishing as the buffer size increases.\r\n\r\n/cc @vishh \r\n\r\nNote: This includes https://github.com/google/cadvisor/pull/1242"},"comment":{"url":"https://api.github.com/repos/google/cadvisor/issues/comments/229830195","html_url":"https://github.com/google/cadvisor/pull/1246#issuecomment-229830195","issue_url":"https://api.github.com/repos/google/cadvisor/issues/1246","id":229830195,"user":{"login":"k8s-bot","id":12551979,"avatar_url":"https://avatars.githubusercontent.com/u/12551979?v=3","gravatar_id":"","url":"https://api.github.com/users/k8s-bot","html_url":"https://github.com/k8s-bot","followers_url":"https://api.github.com/users/k8s-bot/followers","following_url":"https://api.github.com/users/k8s-bot/following{/other_user}","gists_url":"https://api.github.com/users/k8s-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/k8s-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k8s-bot/subscriptions","organizations_url":"https://api.github.com/users/k8s-bot/orgs","repos_url":"https://api.github.com/users/k8s-bot/repos","events_url":"https://api.github.com/users/k8s-bot/events{/privacy}","received_events_url":"https://api.github.com/users/k8s-bot/received_events","type":"User","site_admin":false},"created_at":"2016-07-01T01:09:36Z","updated_at":"2016-07-01T01:09:36Z","body":"Jenkins GCE e2e\n\nBuild/test **passed** for commit 8204fcd8be134320c351472f46c7476e9117200f.\n* [Build Log](https://storage.cloud.google.com/kubernetes-jenkins/pr-logs/pull/1246/cadvisor-pull-build-test-e2e/693/build-log.txt)\n\n"}}
{"actor":{"display_login":"k8s-bot"}}