изменена реализация Abs для целых на тривиальную. Ускорение - в 2.5 раза
This commit is contained in:
parent
ea669a4c4f
commit
1d09aa7a15
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "8";
|
public const string Minor = "8";
|
||||||
public const string Build = "3";
|
public const string Build = "3";
|
||||||
public const string Revision = "3113";
|
public const string Revision = "3114";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%MINOR%=8
|
|
||||||
%REVISION%=3113
|
|
||||||
%COREVERSION%=3
|
%COREVERSION%=3
|
||||||
|
%REVISION%=3114
|
||||||
|
%MINOR%=8
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
11
InstallerSamples/Other/SpeedTests/AbsVsMathAbs.pas
Normal file
11
InstallerSamples/Other/SpeedTests/AbsVsMathAbs.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Abs для целых работает в 2.5 раза быстрее Math.Abs
|
||||||
|
begin
|
||||||
|
var s := 0;
|
||||||
|
var n := MaxInt;
|
||||||
|
loop n do
|
||||||
|
s := Abs(-2);
|
||||||
|
Print(MillisecondsDelta);
|
||||||
|
loop n do
|
||||||
|
s := System.Math.Abs(-2);
|
||||||
|
Print(MillisecondsDelta);
|
||||||
|
end.
|
||||||
|
|
@ -1 +1 @@
|
||||||
3.8.3.3113
|
3.8.3.3114
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.8.3.3113'
|
!define VERSION '3.8.3.3114'
|
||||||
|
|
|
||||||
|
|
@ -8275,13 +8275,13 @@ function Sign(x: uint64): integer := 1;
|
||||||
|
|
||||||
function Sign(x: real): integer := Math.Sign(x);
|
function Sign(x: real): integer := Math.Sign(x);
|
||||||
|
|
||||||
function Abs(x: shortint): shortint := Math.Abs(x);
|
function Abs(x: shortint): shortint := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: smallint): smallint := Math.Abs(x);
|
function Abs(x: smallint): smallint := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: integer): integer := Math.Abs(x);
|
function Abs(x: integer): integer := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: int64): int64 := Math.Abs(x);
|
function Abs(x: int64): int64 := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: BigInteger): BigInteger := BigInteger.Abs(x);
|
function Abs(x: BigInteger): BigInteger := BigInteger.Abs(x);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8275,13 +8275,13 @@ function Sign(x: uint64): integer := 1;
|
||||||
|
|
||||||
function Sign(x: real): integer := Math.Sign(x);
|
function Sign(x: real): integer := Math.Sign(x);
|
||||||
|
|
||||||
function Abs(x: shortint): shortint := Math.Abs(x);
|
function Abs(x: shortint): shortint := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: smallint): smallint := Math.Abs(x);
|
function Abs(x: smallint): smallint := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: integer): integer := Math.Abs(x);
|
function Abs(x: integer): integer := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: int64): int64 := Math.Abs(x);
|
function Abs(x: int64): int64 := if x >= 0 then x else -x;
|
||||||
|
|
||||||
function Abs(x: BigInteger): BigInteger := BigInteger.Abs(x);
|
function Abs(x: BigInteger): BigInteger := BigInteger.Abs(x);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue