Archive for April, 2007

Delving into the Firefox source code

Friday, April 27th, 2007

Continuing from the previous post. I downloaded the Firefox source code and started trying to figure out why textContent was faster than innerHTML.

The FF source code is a daunting beast, around 57,000 files. I started with grep. this returned 57 files for innerHTML and 72 files for textContent. I then used comm to see which files had both words in them, only one did.

Somehow I decided to try looking at the idl files that grep returned. From these files I was able to figure out what I thought were the .cpp files related to the properties.

Here are links to the files on Mozilla’s website
innerHTML is found in this file
nsGenericHTMLElement.cpp
Here is a changelog of the setInnerHTML function
http://lxr.mozilla.org/mozilla1.8/ident?i=SetInnerHTML

Here is the cpp file that contains textContent
nsHTMLOptionElement.cpp
here is the changelog of the setText function
http://lxr.mozilla.org/mozilla1.8/ident?i=SetText

I haven’t actually yet figured out what each function does, but I’m getting there. I’m also not sure if I have the correct file for textContent.

speed of innerHTML vs textContent

Friday, April 27th, 2007

I was working on one of my js apps that updates the content of an element on mouseover. The performance in FF 2 was poor compared to all other browsers. After profiling with Firebug I realized that the problem was setting the innerHTML of an element. In Firebug, setting the innerHTML took about 3 times as long as the rest of the code for the mouseover, which included getting the mouse position, pulling a value from a large array, performing math on that number, and moving a cursor to the proper place on the screen.

I looked up the js docs, and found that FF elements have a property named textContent. I used this property instead of innerHTML, and performance for the mouseover doubled.

I was happy about finding this quirk. Then I told my friend Derik about it, he asked “did you look at the source to figure out why textContent is faster?”, then he called me a pussy when I told him I hadn’t.

The next post will be about delving into the Firefox source code

I made Dstillz’s interesting chat list

Monday, April 23rd, 2007

I made my friend Dstillz’s interesting chat list. Pretty cool. dstillz

An interesting site about music production

Monday, April 23rd, 2007

I was watching the “Sexy Back” video today. I thought that a femaile sung the song, apparently not. So I did a search about the song’s production. I ran into this site Pro Audio Review. The site details the song’s production. Who knew such a site exists.

I’m not going to be a nice blogger.

Tuesday, April 10th, 2007

You might consider what I say nice. I might be have moments of kindness. I’m not saying I’m going to aim to be mean or cruel. What I am saying is that I’m not going to sign any blogger code of conduct.

Here is why
The big deal about blogging is that it breaks down barriers to entry for publishing. That’s why it scared the shit out of traditional media, thats why they made fun of it. Thats why they questioned whether or not bloggers were true journalists, and whether or not they should be afforded the same protections… because they were scared.

Look at who is proposing a code of ethics Tim O’Reily , Dooce, Kathy Sierra. All popular bloggers and important people. Now I’m sure they don’t even think that they are restricting free speech, or putting up a barrier to entry, but watch, it will happen. Like any club, it seems harmless enough, but what happens next.

What happens when Reddit, or Digg won’t accept a link unless its from a ‘nice’ blog?

Well now who ever decides if a blog is nice has a lot of power. And who is on the commitee for deciding what the standards for nice are, that’s right, O’Reilly, Sierra, and Dooce. Thy will have more power than they now have, and power corrupts.

Of course when Reddit or Digg stops accepting ‘mean’ submissions there will be another news aggregating site, maybe ‘meanit’. I’d love to write that.

So thats why I’m not going to join a blogging code of ethics

Why I chose to be a programmer

Monday, April 2nd, 2007

I’m not sure what to title this. “Why I’m not an economist… Why economists are hypocrites…” but I decided to go with something positive.

So I graduated about a year and a half ago with an Economics degree from George Mason University. I enjoyed the way my degree taught me to think and analyze things. I agree with the tenets of Mason’s econ program (free markert libertarianism). But I didn’t want to be an economist.

I realized that if I became an economist, I would sit in a room and write papers, do studies, and pontificate about things that I had no hope of ever changing. That sounded like a career of frustration. I also knew that my career would be dependent on intra office politics and more schooling compared to actual accomplishment and ability.

So I decided to become a programmer. I have used and programmed computers for years and started off college as a CS major (thats another story). I built a we app in my spare time ( http://formula1db.com ) a couple of weeks after I finished classes and was quickly hired. I chose to be a programmer for many reasons

1. I build things. I like building things and having a tangible result. I take pride in this and I get to do this with my career.
2. This is not a risk averse field. Yes I could hose a database or a server, but a properly architected system will have a backup plan. This allows potential employers and me to be much more daring. I was able to be hired with comparatively little experience because if I screwed up they would only be out my wage (I couldn’t nock down a building, kill a patient, or cause millions in financial damage by a mistake).
3. This is a field with low barriers to entry. This was important for me for my initial job but is also important for a couple of other reasons. I can cheaply start my own company, I only have to feed myself for a couple months. I can also practice at home on my own equipment to become better with my trade. Imagine a pediatrician asking to take a baby home for a night or two to practice appendectomys. Because there is a low barrier to entry this career also doesn’t suffer from ivory towers, any nobody can come up with a good idea, I like this because it keeps me on my feet.

Now I have tried to be positive, here is some friendly jabbing at economists, specifically free market classicals.

For a group which decries unions, government regulation, and barriers to entry aren’t they all hypocrits for chosing a profession which has all of those characteristics. (I will write the first comment on this article picking my arguments apart).

My degree advisor, Bryan Caplan has written many papers about why higher education is inneficient and should be disincentivized. This was a running joke around the department because he of course also argued that economists are important and should be incetivized, I think we all recognized the humor.