{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/issues/125","repository_url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl","labels_url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/issues/125/comments","events_url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/issues/125/events","html_url":"https://github.com/JuliaCI/BenchmarkTools.jl/issues/125","id":374186392,"node_id":"MDU6SXNzdWUzNzQxODYzOTI=","number":125,"title":"stop printing \"humanized\" time units","user":{"login":"StefanKarpinski","id":153596,"node_id":"MDQ6VXNlcjE1MzU5Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/153596?v=4","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-10-26T00:50:29Z","updated_at":"2018-10-30T17:37:41Z","closed_at":null,"author_association":"NONE","body":"On Slack today, some timings were posted:\r\n```jl\r\njulia> @btime sum(a) > 0\r\n  26.323 μs (1 allocation: 16 bytes)\r\nfalse\r\n\r\njulia> @btime any(a .> 0)\r\n  116.147 μs (5 allocations: 16.64 KiB)\r\ntrue\r\n\r\njulia> @btime any(!iszero, a)\r\n  178.574 ns (0 allocations: 0 bytes)\r\ntrue\r\n```\r\nThe entire ensuing conversation was predicated on the fact that `any(!iszero, a)` was mysteriously slower than both `sum(a) > 0` and `any(a .> 0)`. Nobody noticed that the last time measurement is in **nanoseconds** while the first two are in **microseconds**. I've seen this happen quite often. It's happened to me. The reason I knew to be alert to this is because I've missed the very subtle difference between \"ms\", \"μs\" and \"ns\" before. Moreover, this doesn't match how Base prints times anymore:\r\n```jl\r\njulia> @time sleep(1)\r\n  1.047126 seconds (114.42 k allocations: 6.038 MiB, 0.90% gc time)\r\n\r\njulia> @time sleep(0.001)\r\n  0.006039 seconds (82 allocations: 5.375 KiB)\r\n```\r\nIn fact, Base's time printing was changed for the exact same reason! I propose that we choose one of the following ways to print times instead:\r\n```\r\n  0.000026323 seconds (1 allocation: 16 bytes)\r\n  0.000116147 seconds (5 allocations: 16.64 KiB)\r\n  0.000000179 seconds (0 allocations: 0 bytes)\r\n```\r\nIn other words, with a fixed 9 decimal digits and room for up to three leading digits. That's plenty of digits and it's *very* clear what scale values are on. If the values _must_ be scaled somehow, then consider using engineering notation instead, so something like this:\r\n```jl\r\n  26.323e-6 seconds (1 allocation: 16 bytes)\r\n 116.147e-6 seconds (5 allocations: 16.64 KiB)\r\n 179.000e-9 seconds (0 allocations: 0 bytes)\r\n```\r\nBut note that this is not much shorter and far less clear than just printing 9 digits after the decimal."},"comment":{"url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/issues/comments/434399272","html_url":"https://github.com/JuliaCI/BenchmarkTools.jl/issues/125#issuecomment-434399272","issue_url":"https://api.github.com/repos/JuliaCI/BenchmarkTools.jl/issues/125","id":434399272,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDM5OTI3Mg==","user":{"login":"JeffreySarnoff","id":1682118,"node_id":"MDQ6VXNlcjE2ODIxMTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1682118?v=4","gravatar_id":"","url":"https://api.github.com/users/JeffreySarnoff","html_url":"https://github.com/JeffreySarnoff","followers_url":"https://api.github.com/users/JeffreySarnoff/followers","following_url":"https://api.github.com/users/JeffreySarnoff/following{/other_user}","gists_url":"https://api.github.com/users/JeffreySarnoff/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffreySarnoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffreySarnoff/subscriptions","organizations_url":"https://api.github.com/users/JeffreySarnoff/orgs","repos_url":"https://api.github.com/users/JeffreySarnoff/repos","events_url":"https://api.github.com/users/JeffreySarnoff/events{/privacy}","received_events_url":"https://api.github.com/users/JeffreySarnoff/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T17:37:41Z","updated_at":"2018-10-30T17:37:41Z","author_association":"CONTRIBUTOR","body":"seconds are too coarse when measuring differences in nanoseconds\nnanoseconds are too fine when measuring differences in seconds\n\n\nOn Tue, Oct 30, 2018 at 10:50 AM Kristoffer Carlsson <\nnotifications@github.com> wrote:\n\n> Google benchmark prints ns\n> https://github.com/google/benchmark#counter-reporting.\n>\n> ------------------------------------------------------------------------------\n> Benchmark                        Time           CPU Iterations UserCounters...\n> ------------------------------------------------------------------------------\n> BM_UserCounter/threads:8      2248 ns      10277 ns      68808 Bar=16 Bat=40 Baz=24 Foo=8\n> BM_UserCounter/threads:1      9797 ns       9788 ns      71523 Bar=2 Bat=5 Baz=3 Foo=1024m\n>\n> Cargo benchmark seems to print ns (not sure if it changes based on the\n> absolute numbers)\n>\n> test tests::bench_add_two ... bench:         1 ns/iter (+/- 0)\n>\n> Another rust benchmark framework prints (\n> https://github.com/japaric/criterion.rs) prints something like\n>\n> [26.029 us 26.251 us 26.505 us]\n>\n> Go benchmark prints in ns\n>\n> BenchmarkFib1   1000000000               2.84 ns/op\n> BenchmarkFib2   500000000                7.92 ns/op\n> BenchmarkFib3   100000000               13.0 ns/op\n> BenchmarkFib10   5000000               447 ns/op\n> BenchmarkFib20     50000             55668 ns/op\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/JuliaCI/BenchmarkTools.jl/issues/125#issuecomment-434330917>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ABmqxvJlkpt-0FYU9BSIGwQVm2UhmHOTks5uqGc4gaJpZM4X7WWb>\n> .\n>\n"}}
{"actor":{"display_login":"JeffreySarnoff"}}