Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some System.Decimal performance improvements (#99212)
* Improve performance of decimal division * Remove usage of mulx via instrinct on 32bit x86 since it produces worse code than Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 | Method | a | b | Mean | Error | StdDev | Allocated | |--------------------------- |-- |----------- |---------:|----------:|----------:|----------:| | Mul64By32_New | 3 | 4294967295 | 2.068 ns | 0.0459 ns | 0.0383 ns | - | | Mul64By32_Ori | 3 | 4294967295 | 2.916 ns | 0.0231 ns | 0.0193 ns | - | * update part of Multiply - Add comment to BigMul64By32 and make it return nunit to avoid clearing upper 32 bits - Simplify IncreaseScale * remove unintentional file * Improve division by 64bit value on x64 * Remove some more 64bit divides for x86 * Call IncreaseScale in one more place * add extra paranthesis * review: remove X86.X86Base.X64.DivRem * Remove BigMul64By32 and add overloads of Math.BigMul instead so that it can easily be removed once JIT recognize and optimize "ulong * uint" * Simplify Div96By32 * Remove 64 bit path from Div96By32 * Add Div64By32 helper to avoid check for X86 in multiple places * Use 64*32 multiply in more places * Add new IncreaseScale overload to fix issue with Store-To-Load forwarding * Gives around 20% faster perf for 64bit for full 96bit division * removes cast * Add back old 32bit code for IncreaseScale * makes the 5-10% regression 20% faster (25% speedup) for 1/3 * 6% faster with longer increasescale * Add back Bmi2.MultiplyNoFlags in Math.BigMul * fix Math.Bigmul compilation * switch from Bigmul to (ulong)a * (uint)b in IncreaseScale * Gives up to 10ns (or 14% faster) * Call IncreaseScale(ref Buf12) from IncreaseScale(ref Buf16) for 32bit code * Add #pragma warning disable CA2252 * Change supression to SYSLIB5004 now that DivRem is marked as [Experimental] --------- Co-authored-by: Tanner Gooding <[email protected]>
- Loading branch information