<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
    <title>JavaScript Rules - opera</title>
    <link href="http://javascriptrules.com/tag/opera.xml" rel="self"/>
    <link href="http://javascriptrules.com"/>
    <updated>2012-03-08T18:28:28-08:00</updated>
    <id>http://javascriptrules.com/tag/opera</id>
    <author>
        <name>Marcel Duran</name>
        <email>marcelduran@gmail.com</email>
    </author>
 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <entry>
        <title>Finding prime numbers with Javascript</title>
        <link href="http://javascriptrules.com/2009/10/16/finding-prime-numbers-with-javascript"/>
        <updated>2009-10-16T00:00:00-07:00</updated>
        <id>/2009/10/16/finding-prime-numbers-with-javascript</id>
        <content type="html">&lt;p&gt;A few days ago I introduced a friend of mine Jorge Rocha to &lt;a href='https://www.spoj.pl/'&gt;SPOJ&lt;/a&gt; an online judge system for user-submitted programs, one of the first problems that he tried was the &lt;a href='https://www.spoj.pl/problems/PRIME1/'&gt;Prime Generator&lt;/a&gt; it consisted in finding all primes in a given range of numbers, after some time and few different algorithms he asked me if I had any tips to help him, although he had the correct algorithm &lt;a href='http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes'&gt;(Sieve of Eratosthenes)&lt;/a&gt; something was clearly missing, the solution wasn&amp;#8217;t fast enough and I had no clue where to go from there, so as usual when a question like that comes up I resort to &lt;a href='http://fzort.org/mpr/'&gt;Mauro Persano&lt;/a&gt;&amp;#8230; and obviously he knew the answer, he taught us how to apply a heuristic to the algorithm to help solve the problem and after doing so the code worked and the solution was approved.&lt;/p&gt;

&lt;p&gt;Although I&amp;#8217;m not really into crazy algorithms challenges I thought I&amp;#8217;d give it a try just to see how fast the solution would be in JS, note that most of the solutions submitted are in C/C++ or Java, much faster than JS and to make things worst the interpreter was &lt;a href='http://www.mozilla.org/rhino/'&gt;Rhino&lt;/a&gt;, anyways we went ahead and recreated the solution in Javascript, so now it was time to test it&amp;#8230; a little more tweaking to make it receive inputs via console and we had it running, right away we realized that our output via &lt;a href='http://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29'&gt;stdout&lt;/a&gt; was slowing us down, printing 10 times in a row all primes until 1 billion in the shell is not really fast but it was required to, I knew we had little or no chances to get approved but anyways we tried&amp;#8230; and as I suspected we didn&amp;#8217;t get approved :(, but I decided to test locally in different browsers/engines with and without output.&lt;/p&gt;

&lt;p&gt;Here are the results, I also built a &lt;a href='http://sandbox.javascriptrules.com/prime1/'&gt;test runner&lt;/a&gt; so you can test on your own:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome is usually the best, &lt;a href='http://code.google.com/p/v8/'&gt;V8&lt;/a&gt; is blazing fast but it chokes when outputting the results through &lt;a href='http://webkit.org/'&gt;WebKit&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Rhino does a great job specially with a high number of runs because of &lt;a href='http://en.wikipedia.org/wiki/Java_Virtual_Machine'&gt;JVM&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Firefox runs nicely with short ranges but stops the script because of the &lt;a href='http://www.nczonline.net/blog/2009/01/05/what-determines-that-a-script-is-long-running/'&gt;long time running&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Opera wasn&amp;#8217;t fast but it never crashed or stopped&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Browser/Engine&lt;/th&gt;&lt;th&gt;# of runs&lt;/th&gt;&lt;th&gt;Avg(ms) 0 - 100 thousand&lt;/th&gt;&lt;th&gt;Avg(ms) 0 - 1 million&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Rhino 1.7 *&lt;/td&gt;&lt;td style='text-align: center;'&gt;10&lt;/td&gt;&lt;td style='text-align: right;'&gt;250&lt;/td&gt;&lt;td style='text-align: right;'&gt;2330&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Firefox 3.5.3 *&lt;/td&gt;&lt;td style='text-align: center;'&gt;10&lt;/td&gt;&lt;td style='text-align: right;'&gt;670&lt;/td&gt;&lt;td style='text-align: right;'&gt;Stopped&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Chrome 4.0 *&lt;/td&gt;&lt;td style='text-align: center;'&gt;10&lt;/td&gt;&lt;td style='text-align: right;'&gt;32&lt;/td&gt;&lt;td style='text-align: right;'&gt;3050&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Opera 10 *&lt;/td&gt;&lt;td style='text-align: center;'&gt;10&lt;/td&gt;&lt;td style='text-align: right;'&gt;540&lt;/td&gt;&lt;td style='text-align: right;'&gt;4956&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Rhino 1.7&lt;/td&gt;&lt;td style='text-align: center;'&gt;100&lt;/td&gt;&lt;td style='text-align: right;'&gt;34&lt;/td&gt;&lt;td style='text-align: right;'&gt;304&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Firefox 3.5.3&lt;/td&gt;&lt;td style='text-align: center;'&gt;100&lt;/td&gt;&lt;td style='text-align: right;'&gt;20&lt;/td&gt;&lt;td style='text-align: right;'&gt;Stopped&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Chrome 4.0&lt;/td&gt;&lt;td style='text-align: center;'&gt;100&lt;/td&gt;&lt;td style='text-align: right;'&gt;9&lt;/td&gt;&lt;td style='text-align: right;'&gt;128&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td style='text-align: left;'&gt;Opera 10&lt;/td&gt;&lt;td style='text-align: center;'&gt;100&lt;/td&gt;&lt;td style='text-align: right;'&gt;100&lt;/td&gt;&lt;td style='text-align: right;'&gt;1213&lt;/td&gt;
&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;&lt;em&gt;* With output (tested under &lt;a href='http://www.ubuntu.com/'&gt;Ubuntu 9.04 Jaunty&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;</content>
    </entry>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <entry>
        <title>What's going on with Firebug?</title>
        <link href="http://javascriptrules.com/2009/07/01/whats-going-on-with-firebug"/>
        <updated>2009-07-01T00:00:00-07:00</updated>
        <id>/2009/07/01/whats-going-on-with-firebug</id>
        <content type="html">&lt;p&gt;&lt;em&gt;UPDATE - july 2nd&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Since my post yesterday, the firebug developers have released another version of the tool (1.4.0b4) it seems more stable, great job!&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;When Mozilla launched &lt;a href='http://www.mozilla.com/en-US/firefox/firefox.html'&gt;Firefox 3.5&lt;/a&gt; a couple days ago, I was forced to upgrade my FB (firebug) to the new &lt;a href='https://addons.mozilla.org/en-US/firefox/addons/versions/1843#version-1.4.0b2'&gt;1.4 beta version&lt;/a&gt;, although the new FB has been &lt;a href='http://blog.getfirebug.com/'&gt;greatly improved&lt;/a&gt; it still has a lot bugs as you&amp;#8217;d expect on a beta version, but that&amp;#8217;s not the bad part, the new FF3.5 is really fast and has really &lt;a href='http://www.mozilla.com/en-US/firefox/features/'&gt;cool new features&lt;/a&gt; but FB is making the browser choke and freeze all the time, it&amp;#8217;s no news that FB has become more and more slow and buggy each version.&lt;/p&gt;

&lt;p&gt;I don&amp;#8217;t mean to sound harsh and I have always been a fan of FB, it was the one tool that brought us from the dark ages of alert() debugging to a more professional debugging, but something has to be done urgently, rightnow you can&amp;#8217;t even think about debugging heavy web apps.&lt;/p&gt;

&lt;p&gt;So, what could be done? Maybe Mozilla could adopt it as part of the browser, I know it would probably need major refactoring, but as far as I can tell built-in tools are much faster, like &lt;a href='http://trac.webkit.org/wiki/Web%20Inspector'&gt;Webkit&amp;#8217;s Web Inspector&lt;/a&gt; (Safari only, the Chrome implementation has a lot of bug fixing to do) and also &lt;a href='http://www.opera.com/dragonfly/'&gt;Opera&amp;#8217;s Dragonfly&lt;/a&gt;, as for IE&amp;#8230; well you know, not worth mentioning ;) Or maybe the FB developers could focus more on performance than adding new features.&lt;/p&gt;

&lt;p&gt;I know I could switch to Safari, Chrome or even Opera, but the point is FF really deserves a great developer tool like FB was a while ago :)&lt;/p&gt;</content>
    </entry>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
 
</feed>

