Skip to content

RyuJIT performance regression with bool to int conversions #4398

@redknightlois

Description

@redknightlois

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.

// BenchmarkDotNet=v0.7.6.0
// OS=Microsoft Windows NT 6.2.9200.0
// Processor=Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz, ProcessorCount=4
// CLR=MS.NET 4.0.30319.42000, Arch=64-bit [RyuJIT]
Common: Type=Jit_BoolToInt Mode=Throughput Platform=X64 .NET=Current

Method Jit AvrTime StdDev op/s
Framework LegacyJit 1.16 us 28.20 ns 858517.79
IfThenElse LegacyJit 1.08 us 44.58 ns 929458.93
UnsafeConvert LegacyJit 595.83 ns 5.79 ns 1678333.61
Framework RyuJit 1.31 us 18.64 ns 765539.56
IfThenElse RyuJit 1.31 us 16.05 ns 761023.73
UnsafeConvert RyuJit 896.80 ns 6.27 ns 1115078.04

Code in question: https://gist.github.com/redknightlois/c1ae5ddc6f73c2e53c9b

category:cq
theme:basic-cq
skill-level:intermediate
cost:medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions