{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18170","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18170/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18170/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18170/events","html_url":"https://github.com/kubernetes/kubernetes/pull/18170","id":120272588,"number":18170,"title":"api/resource: optimize scale function","user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/lgtm","name":"lgtm","color":"15dd18"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/L","name":"size/L","color":"ee9900"}],"state":"open","locked":false,"assignee":{"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},"milestone":null,"comments":13,"created_at":"2015-12-03T21:20:53Z","updated_at":"2015-12-04T01:20:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18170","html_url":"https://github.com/kubernetes/kubernetes/pull/18170","diff_url":"https://github.com/kubernetes/kubernetes/pull/18170.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/18170.patch"},"body":"The original scale function takes around 800ns/op with more\r\nthan 10 allocations. It significantly slow down scheduler\r\nand other components that heavily relys on resource pkg.\r\nFor more information see #18126.\r\n\r\nThis pull request tries to optimize scale function. It takes\r\ntwo approach:\r\n\r\n1. when the value is small, only use normal math ops.\r\n2. when the value is large, use math.Big with buffer pool.\r\n\r\nThe final result is:\r\n```\r\nBenchmarkScaledValueSmall-4\t20000000\t        66.9 ns/op\t       0 B/op\t       0 allocs/op\r\nBenchmarkScaledValueLarge-4\t 2000000\t       711 ns/op\t      48 B/op\t       1 allocs/op\r\n```\r\n\r\nI also run the scheduler benchmark again. It doubles the throughput of\r\nscheduler for 1000 nodes case.\r\n\r\n/cc @timstclair  "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/161844410","html_url":"https://github.com/kubernetes/kubernetes/pull/18170#issuecomment-161844410","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18170","id":161844410,"user":{"login":"k8s-merge-robot","id":13653959,"avatar_url":"https://avatars.githubusercontent.com/u/13653959?v=3","gravatar_id":"","url":"https://api.github.com/users/k8s-merge-robot","html_url":"https://github.com/k8s-merge-robot","followers_url":"https://api.github.com/users/k8s-merge-robot/followers","following_url":"https://api.github.com/users/k8s-merge-robot/following{/other_user}","gists_url":"https://api.github.com/users/k8s-merge-robot/gists{/gist_id}","starred_url":"https://api.github.com/users/k8s-merge-robot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k8s-merge-robot/subscriptions","organizations_url":"https://api.github.com/users/k8s-merge-robot/orgs","repos_url":"https://api.github.com/users/k8s-merge-robot/repos","events_url":"https://api.github.com/users/k8s-merge-robot/events{/privacy}","received_events_url":"https://api.github.com/users/k8s-merge-robot/received_events","type":"User","site_admin":false},"created_at":"2015-12-04T01:20:52Z","updated_at":"2015-12-04T01:20:52Z","body":"Travis continuous integration appears to have missed, closing and re-opening to trigger it"}}