Created
May 9, 2018 12:11
-
-
Save kyranet/77eb9f7fd51af3426b28db2a682b4c15 to your computer and use it in GitHub Desktop.
JS' BigInt vs C#'s BigInteger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Numerics; | |
using System.Diagnostics; | |
namespace CSBenchmark | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var sw = Stopwatch.StartNew(); | |
BigInteger.Pow(new BigInteger(56), 448000); | |
Console.WriteLine(sw.Elapsed); | |
Console.ReadLine(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const now = Date.now(); | |
56n ** 448000n; | |
Date.now() - now; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Numerics; | |
using System.Diagnostics; | |
namespace CSBenchmark | |
{ | |
class Program | |
{ | |
static BigInteger value; | |
static void Main(string[] args) | |
{ | |
value = BigInteger.Pow(new BigInteger(56), 448000); | |
var sw = Stopwatch.StartNew(); | |
value.ToString(); | |
Console.WriteLine(sw.Elapsed); | |
Console.ReadLine(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const n = 56n ** 448000n; | |
const now = Date.now(); | |
n.toString(); | |
Date.now() - now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment