mirror of
https://github.com/claunia/plist-cil.git
synced 2026-02-04 05:34:41 +00:00
[PR #59] [MERGED] Use 1 << exp instead of Math.Pow(2, exp) #97
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/claunia/plist-cil/pull/59
Author: @qmfrederik
Created: 6/12/2019
Status: ✅ Merged
Merged: 6/12/2019
Merged by: @claunia
Base:
master← Head:fixes/math-pow📝 Commits (1)
40dbb46Use 1 << exp instead of Math.Pow(2, exp)📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
plist-cil/BinaryPropertyListParser.cs(+3 -3)📄 Description
Math.Pow(double, double)is a relatively expensive operation (since it can take an arbitrary exponent). For powers of two, byteshift operators are much faster.Benchmark.NET can't actually measure the time it takes to do
1 << exp, butMath.Pow(2, exp)takes about 40 nanoseconds. It was actually slow enough to show up in some of the performance traces we took.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.