r/programming • • Dec 20 '10

A Christmas Tree in 1k of Javascript

http://www.romancortes.com/blog/how-i-did-the-1kb-christmas-tree/
1.1k Upvotes

221 comments sorted by

View all comments

42

u/ImTheGuyWithTheGun Dec 20 '10 edited Dec 20 '10

Amazing how much smoother this runs in Chrome compared to Firefox. And IE8 - forget about it.

EDIT: Safari 5 seems even worse than Firefox. My system is a core-i5 w/ 6GB on Win7 - should be plenty of horsepower.

7

u/[deleted] Dec 20 '10 edited Oct 02 '26

[removed] — view removed comment

12

u/mrkite77 Dec 20 '10

chrome has incredible javascript performance. I made a 68k emulator in javascript that had no problem running at 1mhz on chrome.

6

u/feureau Dec 21 '10

I made a 68k emulator in javascript

... whoat?!

68k emulator in javascript

@_@

68k emulator in javascript

WANT!!!

1

u/mrkite77 Dec 21 '10

It's just the CPU, I did it to run Magnetic Scrolls adventure games in the browser (they're basically just 68K code with some special A-Line traps).

1

u/feureau Dec 21 '10

Still, ... Cool stuff! ^

1

u/Concise_Pirate Dec 21 '10

Hats off to ye.

1

u/irascible Dec 21 '10

Do you mean your emulator was 68k big, or you were emulating a motorola 68000?.. and if it was the motorola... are you talking about emulating for a mac game? and if so... have you ever played the game Hellcats over the Pacific? and if so... we should talk because I would kill to have a working version of that game on the PC again.

2

u/mrkite77 Dec 21 '10

A motorola 68000, although it's a slightly stripped down 68k, without an eXtend flag, so none of the opcodes that rely on that flag are implemented (abcd, addx, subx, roxl, etc). (Like I said in the other reply, this was specifically to run Magnetic Scrolls text adventure games.. like The Pawn. They were originally written on the Amiga, the game logic itself targeted this theoretical stripped down 68k cpu to make it portable. So, for example, there was a light-weight 68k emulator built into the Apple II version of The Pawn, which is rather impressive).

As far as your Hellcats over the Pacific game goes, you can get everything to need to run it in emulation here: http://macintoshgarden.org/games/hellcats-over-the-pacific

1

u/ToraxHunt Dec 20 '10

Each browser has stronger areas where they render faster. Chrome just happens to be good at this kind of thing. There are areas where each IE8-IE9 and Firefox are faster.

10

u/pkkid Dec 20 '10

Could you be a bit more specific please?

(curious minds want to know)

-2

u/signoff Dec 21 '10
  • Chrome = good at this kind of thing

  • IE8-IE9 = good at other kind of thing

  • Firefox = good at other kind of thing

5

u/pkkid Dec 21 '10

I was actually looking for more concrete references to the claims made and not just a "because I said so" answer that has no merit. But thanks for your input, you helped greatly in this matter. :-/

3

u/ToraxHunt Dec 21 '10

Sure, one example is canvas tag surface rendering using your GPU.

http://www.geek.com/articles/news/ie9-html-5-rendering-test-makes-chrome-6-look-slow-20100624/

Thus, IE9 currently has an advantage on certain scenarios on the canvas tag. As another poster pointed out below, Firefox is better at some scripting scenarios. Like I said, each has strong points, and anyone who throws a blanket over a browser and says "This browser is all crap" is pretty much guaranteed to be ignorant of the facts. I use several browsers depending on what I need to do, and I suggest you do the same. Don't discard any particular browser because of anti-fanboyism.

1

u/Evansbee Dec 21 '10

I'm sorry, but I don't think using several browsers is a feasible suggestion. I can't see my workflow being helped by minor javascript rendering improvements.

Is what you're proposing something as asinine as, "I'm going to facebook, time to open safari, jump to twitter which means chrome, on to reddit which is best in IE9"?

1

u/signoff Dec 21 '10

opera has faster DOM API. not that their javascript runtime is faster.

chrome has faster javascript runtime (except in 64bit OS).

firefox is better overall because it's open sauce unlike other company backed browsers. those proprietary browsers are made for profit be it open sauce or not.

1

u/minikomi Dec 21 '10

And like any good BBQ host knows - when the sauce ain't open, somethin's a cookin!

-2

u/Bloodhound01 Dec 21 '10

there are none that i know of, chrome is incredibly fast at pretty much everything it does. It blows every other browser away at the moment. Its actually crazy how much more advanced it is then other browsers yet people don't seem to understand this. Chrome is like 2 generations ahead of any other browser.

0

u/ascendant512 Dec 21 '10

This comment really takes the cake.

Chrome is definitely not 2 generations ahead of any other browser. It's not even 2 generations ahead of Internet Explorer, the worst of the current set of browsers.

Chrome is not the most customizable, it isn't the most secure, it's not the most resource-efficient, there are even other browsers that look better than it. The only thing it was the best at for any period of time was javascript and html rendering performance.

And even then, it wasn't leading the pack by an enormous margin. It's been in a very close race with WebKit (Safari and Konqueror) for a good while. Finally, see if this doesn't blow your mind: Firefox 4 beta 7's javascript performance is faster than both!

3

u/abadidea Dec 21 '10

but Chrome is Webkit...

1

u/ascendant512 Dec 21 '10

Haha, whoops. Well, I meant to be comparing the javascript engines.

  • V8 in Chrome

  • Carakan in Opera

  • -monkey in Firefox

  • SquirrelFish in Safari

  • and whatever abortion IE uses

→ More replies (0)

2

u/joanthens Dec 21 '10

very close race with webkit? so it's racing against itself?

1

u/[deleted] Dec 21 '10

SHHH he's an expert (at telling people that Chrome is not as good as they perceive it to be).

→ More replies (1)

1

u/[deleted] Dec 21 '10

I have both the Firefox 4 beta and Chromium installed, on Linux.

Firefox 4's performance does not equal Chromium's performance for this demo.