{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/folly/issues/409","repository_url":"https://api.github.com/repos/facebook/folly","labels_url":"https://api.github.com/repos/facebook/folly/issues/409/labels{/name}","comments_url":"https://api.github.com/repos/facebook/folly/issues/409/comments","events_url":"https://api.github.com/repos/facebook/folly/issues/409/events","html_url":"https://github.com/facebook/folly/issues/409","id":154986756,"number":409,"title":"ProducerConsumerQueue latency benchmark","user":{"login":"artemkin","id":472955,"avatar_url":"https://avatars.githubusercontent.com/u/472955?v=3","gravatar_id":"","url":"https://api.github.com/users/artemkin","html_url":"https://github.com/artemkin","followers_url":"https://api.github.com/users/artemkin/followers","following_url":"https://api.github.com/users/artemkin/following{/other_user}","gists_url":"https://api.github.com/users/artemkin/gists{/gist_id}","starred_url":"https://api.github.com/users/artemkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artemkin/subscriptions","organizations_url":"https://api.github.com/users/artemkin/orgs","repos_url":"https://api.github.com/users/artemkin/repos","events_url":"https://api.github.com/users/artemkin/events{/privacy}","received_events_url":"https://api.github.com/users/artemkin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-16T08:50:03Z","updated_at":"2016-05-16T08:50:03Z","closed_at":null,"body":"Why do you sleep for 1 ms on every iteration before writing to the queue in latency benchmark? What's the reason?\r\n\r\n```\r\n    for (int i = 0; i < iters_; ++i) {\r\n      timespec sleeptime, sleepstart;\r\n      clock_gettime(CLOCK_REALTIME, &sleepstart);\r\n      do {\r\n        clock_gettime(CLOCK_REALTIME, &sleeptime);\r\n      } while (detail::timespecDiff(sleeptime, sleepstart) < 1000000);\r\n\r\n      timespec tv;\r\n      clock_gettime(CLOCK_REALTIME, &tv);\r\n      while (!queue_.write((LatencyType) tv.tv_nsec)) {\r\n      }\r\n    }\r\n```\r\nhttps://github.com/facebook/folly/blob/master/folly/test/ProducerConsumerQueueBenchmark.cpp#L120-L124\r\n\r\nThank you\r\n"}}