Skip to content

CRT Pow function has bad performance on Windows #10798

Open
@fiigii

Description

During benchmarking AoS/SoA ray-tracer dotnet/coreclr#18839, we found that the Vector3 benchmark (RayTracer) is much slower on Windows than Linux.

Execution time Windows Linux
Baseline (RayTracer ) 6.00s 4.13s
PacketTracer 1.20s 1.35s
Performance Gains 5.00x 3.06x

According to VTune analysis, this gap is caused by the CRT math library, which RayTracer uses Math.Pow at https://github.com/dotnet/coreclr/blob/master/tests/src/JIT/Performance/CodeQuality/SIMD/RayTracer/Raytracer.cs#L153

Windows

image

Linux

image

On the left side (AoS means RayTracer), we can see ucrtbase.dll on Windows has much more time consuming and instruction retired than libm-2.23.so on Linux.

The data is collected on Core i9 + VS2017, but Core i7+ VS2015 has the same performance gap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-System.Numericsbacklog-cleanup-candidateAn inactive issue that has been marked for automated closure.enhancementProduct code improvement that does NOT require public API changes/additionsno-recent-activitytenet-performancePerformance related issuetracking-external-issueThe issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions