Skip to content

Instantly share code, notes, and snippets.

@kyranet
Created May 9, 2018 12:11
Show Gist options
  • Save kyranet/77eb9f7fd51af3426b28db2a682b4c15 to your computer and use it in GitHub Desktop.
Save kyranet/77eb9f7fd51af3426b28db2a682b4c15 to your computer and use it in GitHub Desktop.
JS' BigInt vs C#'s BigInteger
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();
}
}
}
const now = Date.now();
56n ** 448000n;
Date.now() - now;
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();
}
}
}
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