Last active
January 4, 2016 14:59
-
-
Save richorama/8638203 to your computer and use it in GitHub Desktop.
Very simple benchmark to see whether its better to compile .NET for x64 for x86 (x86 is faster)
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
# Python 2.7.5, installed via scoop. I'm not convinced that it's actually the 64bit version running. | |
# | |
# Python 2.7.5 x64 | |
# | |
# 3.54650297451ms | |
# 3.60930112911ms | |
# 3.47107861851ms | |
# | |
# Python 2.7.5 x86 | |
# | |
# 3.50084754086ms | |
# 3.52841634987ms | |
# 3.64666031918ms | |
from urlparse import urlparse | |
import time | |
watch = time.clock() | |
x = [] | |
for i in range(0, 1000000): | |
x.append(urlparse('http://www.foo.com')) | |
print str(time.clock() - watch) + "ms" |
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
/* | |
Benchmark implemented in Node.js. The performance is far worse, but x86 still has the edge. | |
Node.js 10.25 x64 | |
19295ms | |
19501ms | |
19438ms | |
Node.js 10.25 x86 | |
17968ms | |
17758ms | |
17930ms | |
*/ | |
var url = require('url'); | |
var watch = new Date().getTime(); | |
var list = []; | |
for (var i = 0; i < 1000000; i++) | |
{ | |
list.push(url.parse("http://www.foo.com/")); | |
} | |
console.log("%sms", new Date().getTime() - watch); |
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
/* | |
Very simple benchmark to see whether its better to compile .NET for x64 for x86 | |
Results on my Lenovo X1 Core i5 pro running on high performance mode | |
Compiled for release x64 | |
999ms | |
1017ms | |
1031ms | |
Compiled for release x86 | |
838ms | |
838ms | |
854ms | |
'Any CPU' seems to target x86. | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
class Program | |
{ | |
static void Main() | |
{ | |
var watch = Stopwatch.StartNew(); | |
var list = new List<Uri>(); | |
for (var i = 0; i < 1000000; i++) | |
{ | |
list.Add(new Uri("http://www.foo.com/")); | |
} | |
watch.Stop(); | |
Console.WriteLine("{0}ms", watch.ElapsedMilliseconds); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment