{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/1306","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/1306/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/1306/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/1306/events","html_url":"https://github.com/dotnet/coreclr/issues/1306","id":97835379,"number":1306,"title":"RyuJIT performance regresion with bool to int conversions","user":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-29T01:28:47Z","updated_at":"2015-07-29T11:06:15Z","closed_at":null,"body":"It looks like RyuJIT is almost 30% less efficient than legacy in bool-to-int conversions. All 3 methods show more or less the same issue. \r\n\r\n// BenchmarkDotNet=v0.7.6.0\r\n// OS=Microsoft Windows NT 6.2.9200.0\r\n// Processor=Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz, ProcessorCount=4\r\n// CLR=MS.NET 4.0.30319.42000, Arch=64-bit  [RyuJIT]\r\nCommon:  Type=Jit_BoolToInt  Mode=Throughput  Platform=X64  .NET=Current\r\n\r\n        Method |       Jit |   AvrTime |   StdDev |       op/s |\r\n-------------- |---------- |---------- |--------- |----------- |\r\n     Framework | LegacyJit |   1.16 us | 28.20 ns |  858517.79 |\r\n    IfThenElse | LegacyJit |   1.08 us | 44.58 ns |  929458.93 |\r\n UnsafeConvert | LegacyJit | 595.83 ns |  5.79 ns | 1678333.61 |\r\n     Framework |    RyuJit |   1.31 us | 18.64 ns |  765539.56 |\r\n    IfThenElse |    RyuJit |   1.31 us | 16.05 ns |  761023.73 |\r\n UnsafeConvert |    RyuJit | 896.80 ns |  6.27 ns | 1115078.04 |\r\n\r\nCode in question: https://gist.github.com/redknightlois/c1ae5ddc6f73c2e53c9b\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/125920595","html_url":"https://github.com/dotnet/coreclr/issues/1306#issuecomment-125920595","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/1306","id":125920595,"user":{"login":"AndreyAkinshin","id":2259237,"avatar_url":"https://avatars.githubusercontent.com/u/2259237?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreyAkinshin","html_url":"https://github.com/AndreyAkinshin","followers_url":"https://api.github.com/users/AndreyAkinshin/followers","following_url":"https://api.github.com/users/AndreyAkinshin/following{/other_user}","gists_url":"https://api.github.com/users/AndreyAkinshin/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreyAkinshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreyAkinshin/subscriptions","organizations_url":"https://api.github.com/users/AndreyAkinshin/orgs","repos_url":"https://api.github.com/users/AndreyAkinshin/repos","events_url":"https://api.github.com/users/AndreyAkinshin/events{/privacy}","received_events_url":"https://api.github.com/users/AndreyAkinshin/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T11:06:15Z","updated_at":"2015-07-29T11:06:15Z","body":"@redknightlois, @mikedn, I think, we should try to avoid work with arrays in this benchmark. Otherwise, we measure conversion time + access to array elements time + CPU cache efficiency.\r\n.NET JIT can generate different version of the array element access code for static arrays, instance arrays, parameter arrays, and local arrays."}}