{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/10962","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/10962/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/10962/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/10962/events","html_url":"https://github.com/JuliaLang/julia/pull/10962","id":70461365,"number":10962,"title":"doc: `@time f_improved` results","user":{"login":"ypeels","id":1558614,"avatar_url":"https://avatars.githubusercontent.com/u/1558614?v=3","gravatar_id":"","url":"https://api.github.com/users/ypeels","html_url":"https://github.com/ypeels","followers_url":"https://api.github.com/users/ypeels/followers","following_url":"https://api.github.com/users/ypeels/following{/other_user}","gists_url":"https://api.github.com/users/ypeels/gists{/gist_id}","starred_url":"https://api.github.com/users/ypeels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ypeels/subscriptions","organizations_url":"https://api.github.com/users/ypeels/orgs","repos_url":"https://api.github.com/users/ypeels/repos","events_url":"https://api.github.com/users/ypeels/events{/privacy}","received_events_url":"https://api.github.com/users/ypeels/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-23T17:00:42Z","updated_at":"2015-04-23T17:35:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/10962","html_url":"https://github.com/JuliaLang/julia/pull/10962","diff_url":"https://github.com/JuliaLang/julia/pull/10962.diff","patch_url":"https://github.com/JuliaLang/julia/pull/10962.patch"},"body":"In the [Performance Tips example](https://github.com/JuliaLang/julia/blob/master/doc/manual/performance-tips.rst#measure-performance-with-objtime-and-pay-attention-to-memory-allocation), I was unable to obtain `112 bytes allocated` for `f_improved` (all I did was change `s = 0` to `s = 0.0`) except on **repeated** calls to `@time f_improved(10^6)`... Repeated calls also change the memory allocated for `@time f(1)`...\r\n\r\nHere are my results, using 64-bit Julia 0.3.7 on Windows 8.1:\r\n\r\n    julia> function f_improved(n)\r\n               s = 0.0\r\n               # rest of function unchanged... is that really all it takes?\r\n           end\r\n\r\n    julia> @time f(1)       # manual: (93784 bytes allocated)\r\n    elapsed time: 0.004260129 seconds (90824 bytes allocated)\r\n\r\n    julia> @time f(1)       # results change on repeated call\r\n    elapsed time: 2.45e-6 seconds (80 bytes allocated)\r\n    \r\n    julia> @time f(10^6)    # manual: (32002136 bytes allocated)\r\n    elapsed time: 0.052752041 seconds (32003256 bytes allocated, 20.53% gc time)\r\n\r\n    julia> @time f_improved(10^6)   # (112 bytes allocated) in manual\r\n    elapsed time: 0.004055749 seconds (75344 bytes allocated)\r\n\r\n    julia> @time f_improved(10^6)\r\n    elapsed time: 0.000867914 seconds (112 bytes allocated)\r\n\r\nYou probably won't want to keep my `75344` number in the manual though, since my other results were all slightly different...\r\n\r\nOther possibilities\r\n- Am I missing something for `f_improved`?  If so, please consider \"open-sourcing\" it in the manual explicitly\r\n- Maybe this is a platform-dependent (Windows-only) issue? But my other numbers for `@time f` are all pretty close...\r\n\r\nThank you!"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/95665773","html_url":"https://github.com/JuliaLang/julia/pull/10962#issuecomment-95665773","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/10962","id":95665773,"user":{"login":"pao","id":140497,"avatar_url":"https://avatars.githubusercontent.com/u/140497?v=3","gravatar_id":"","url":"https://api.github.com/users/pao","html_url":"https://github.com/pao","followers_url":"https://api.github.com/users/pao/followers","following_url":"https://api.github.com/users/pao/following{/other_user}","gists_url":"https://api.github.com/users/pao/gists{/gist_id}","starred_url":"https://api.github.com/users/pao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pao/subscriptions","organizations_url":"https://api.github.com/users/pao/orgs","repos_url":"https://api.github.com/users/pao/repos","events_url":"https://api.github.com/users/pao/events{/privacy}","received_events_url":"https://api.github.com/users/pao/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T17:35:27Z","updated_at":"2015-04-23T17:35:27Z","body":"> except on repeated calls to @time f_improved(10^6)... Repeated calls also change the memory allocated for @time f(1)...\r\n\r\nThe first call also includes the time and allocations of JIT compiling the method. Subsequent calls are using the cached, generated machine code."}}