{"id":6771,"date":"2012-11-01T16:13:38","date_gmt":"2012-11-01T15:13:38","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/?p=6771"},"modified":"2012-11-01T16:13:38","modified_gmt":"2012-11-01T15:13:38","slug":"investigating-surface-rt-performance-counting-primes-in-c-and-javascript","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/6771-investigating-surface-rt-performance-counting-primes-in-c-and-javascript.html","title":{"rendered":"Investigating Surface RT performance: Counting primes in C# and JavaScript"},"content":{"rendered":"<p>How is the performance of Surface RT? Tolerable but rather slow would be my quick summary. Surface RT has a quad-core NVIDIA Tegra 3 chipset.<\/p>\n<p>In order to investigate further, I built a simple app to count primes, using essentially the code <a href=\"http:\/\/www.itwriting.com\/primetest\/countprimes.html\" target=\"_blank\">here<\/a>. I ran the code both in JavaScript and in C#. This is a single ad-hoc and naive test that only covers one aspect of performance, but I have still found it an interesting indicator. I then ran the app both on my Intel Core i5 Samsung Slate and on Surface RT (yes it was interesting figuring out how to debug on Surface RT in a hotel room).<\/p>\n<p>Here are the results:<\/p>\n<p>On Intel Core i5:<\/p>\n<ul>\n<li>Count primes up to 1,000,000: 1.05 secs (in browser) <\/li>\n<li>Count primes up to 1,000,000: 0.88 secs (in embedded webview) <\/li>\n<li>Count primes up to 1,000,000: 0.32 secs (C#) <\/li>\n<li>Count primes up to 10,000,000: 6.31 secs (C#) <\/li>\n<\/ul>\n<p>On Surface RT:<\/p>\n<ul>\n<li>Count primes up to 1,000,000: 3.49 secs (in browser) Slower by 332% <\/li>\n<li>Count primes up to 1,000,000: 3.53 secs (in embedded webview) Slower by 401% <\/li>\n<li>Count primes up to 1,000,000: 1.81 secs (C#) Slower by 565% <\/li>\n<li>Count primes up to 10,000,000: 49.03 secs (C#) Slower by 777% <\/li>\n<\/ul>\n<p>The Core i5 is running at 1.6 Ghz. Surface RT has an NVidia Tegra 3 1.3 Ghz chipset.<\/p>\n<p>You could count primes more quickly in both cases by using parallel processing; this is a single-threaded test.<\/p>\n<p>What is notable here?<\/p>\n<ul>\n<li>First, Surface RT is slower than I would expect and I hope Microsoft improves performance with future updates. <\/li>\n<li>Second, C# is substantially faster than JavaScript in this test, around twice as fast, which makes me question the advice I have heard from some spokespersons that HTML and JavaScript is the preferred approach for apps. <\/li>\n<li>Third, the factor by which C# is slower is greater than the factor by which JavaScript is slower. This surprised me; I had expected the reverse for some reason. <\/li>\n<\/ul>\n<p>Of course, other performance tests will yield different results. When I <a href=\"http:\/\/www.itwriting.com\/blog\/6752-slow-javascript-performance-in-microsoft-surface-rt.html\" target=\"_blank\">tried<\/a> the Sunspider JavaScript test Surface RT was about 5 times slower.<\/p>\n<p>One piece of good news: there was little difference between performance in the embedded or non-embedded browser.<\/p>\n<p><strong>Update<\/strong>: I also tried this test in C++. There was barely any difference. The Core i5 counted primes up to 10,000,000 in 6 seconds. The Surface RT performed the same feat in 46 seconds.<\/p>\n<p><strong>Update 2<\/strong>: A Google Nexus 7, which also has a Tegra 3 chipset, can only manage 76 seconds for the JavaScript test (primes up to 10,000,000). <\/p>\n","protected":false},"excerpt":{"rendered":"<p>How is the performance of Surface RT? Tolerable but rather slow would be my quick summary. Surface RT has a quad-core NVIDIA Tegra 3 chipset. In order to investigate further, I built a simple app to count primes, using essentially the code here. I ran the code both in JavaScript and in C#. This is &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/6771-investigating-surface-rt-performance-counting-primes-in-c-and-javascript.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Investigating Surface RT performance: Counting primes in C# and JavaScript<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,55,80,94],"tags":[586,999],"class_list":["post-6771","post","type-post","status-publish","format-standard","hentry","category-net","category-microsoft","category-software-development","category-visual-studio","tag-microsoft","tag-windows-8"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/6771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=6771"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/6771\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=6771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=6771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=6771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}