Monthly Archives: April 2005

Optimization (not SEO though)

The software that I use for maintaining the BME site has become quite robust over the past few years. As I'm going through emails, the software opens a browser window and instantly displays a custom gallery of all that user's submissions and so on; it's very useful for both getting a reminder of who I'm talking to, and for catching double submissions (I do fingerprinting, but that only catches some since people often send almost identical pictures of the same thing years apart).

Anyway, in order to do this, it has to do a pretty resource intensive build before starting up. The build involves mostly text searches of very large text arrays, and is the only thing in my current maintenance codebase that I'd consider “slow”… As of yesterday, doing the load of all submissions from 2002 on took 6:45 to complete. When I'd initially written it the databases were much smaller, so it wasn't a big deal and I didn't bother to write it efficiently, but a 6:45 hole in my work schedule is surprisingly debilitating.

That said, I knew I was going to have to optimize it in the future, so it wasn't too hard to fix since it had been designed for upgrades. I added a caching scheme for the searches (so it doesn't repeat searches that it's done recently), and tested it on a few cache sizes, eventually settling on caching the previous five searches — this cut the load time down to 1:53, which is back into bearable territory. By the end of the year I'll have to do one more fix, which is making the database sort itself periodically during the load process to allow for binary searches (the input data is in totally random order).

I used this technique on the search engine build routines, and it cut the build down from something like six or seven hours to about half an hour (!!!)… I figure it'll cut the load on this down to under a minute, even with a much larger database. Thinking about optimization is a lot of fun… If it interests you as well, check out the 256 bytes demos archive.

Welcome to Picton

Comments (0)

Now that's a funny tattoo

Willie: Go, go back to the tent!
ALF: It's too dangerous out there, I had to kill a fifty foot snake with my pocket knife!
Willie: There are no fifty foot water snakes in the backyard.
ALF: I'm telling ya, it was bright green and it spit water! Thhft! Thhhft!
Willie: That was my new garden hose.
Alf: Oh, no wonder it was sucking on the spigot!

Porn: Hookers for wimps?

In the current issue of TIME magazine, they have a long article (worth reading for both film and porn buffs) on both classic porn. As is pointed out by Bacchus, the opening lines are a bit of a shocker if you think about what's really being said:


In hotel rooms where pornography is available, two-thirds of all movie purchases are for pornos; and the average time they are watched is 12 minutes. The image instantly summoned is of the traveling businessman who wants a smidge of sexual exercise before retiring, but who is too tired, timid or cheap to summon a call girl.

Now, others are opining about how horrible it would be to be Mary Corliss, wife of the author, since he appears to be saying that he thinks a guy that watches porn instead of calling a prostitute is copping out — I think Rachel would take out a hit on me if I ever wrote a comment like that! However, what I found much more interesting is the comment it makes about sexual attitudes. After all, this isn't writing on some cheesy porn blog — this is TIME magazine!

It's one thing for pornography to have mainstreamed to the point where it can be written about without denouncement and moralizing it to death, but the fact that comments saying that it's not only as normal but better to patronize an escort service than rent an adult video can be nonchalantly dropped in a mainstream magazine really blows me away. I think it's probably a good sign for where society is going, but while on one hand the sexual permissiveness of a culture is a good mark of its freedom and liberty, sexual permissiveness also spikes right before the demise of a complex society.

NO RELIGION ONLY GOD

From the New York Times

International gay leaders are planning a 10-day WorldPride festival and parade in Jerusalem in August, saying they want to make a statement about tolerance and diversity in the Holy City, home to three great religious traditions.

Now major leaders of the three faiths — Christianity, Judaism and Islam — are making a rare show of unity to try to stop the festival. They say the event would desecrate the city and convey the erroneous impression that homosexuality is acceptable. [They describe the festival as] “the spiritual rape of the Holy City. This is not the homo land, this is the Holy Land.”

Look at these smug bastards joking about the queer menace:

It is of only minimal satisfaction to me that the Pope will soon be burning in hell, or at an utter minimum for y'all atheists, dead. I'd have been perfectly happy if an assassin had managed to kill that homophobic murderous bastard years ago — and followed it up by burning Vatican City to the ground. The fact that the one time religions in the Middle East are able to get together and agree on anything is in unity of hatred should tell you something about the evil black heart of organized religion.

I think the thing that made me angriest about the war on Iraq is that Saddam was a wannabe USA-style Playboy. He wasn't fooled by promises of harems full of virgins in the afterlife — he knew the secret was a few slutty cheerleaders after a night of partying and heavy drinking. Seriously though, the reason Iraq was invaded was because it was modernizing and Westernizing. As I've mentioned before, if you looked at downtown Baghdad five years ago, it might as well have been Philadelphia — same advertising on the bus stops, everything. Now, that doesn't mean I'd be moving from Fourth and South to Al Khulafa and Al Thawra, but it's a hell of a lot better than living in Tehran.

I have nothing but contempt for religious regimes. If it weren't for my general and overwhelming pacifism, I'd have had no real complaint if the warmonger nutcases in America had said “let's bomb Iran, and when we're done with that, we can unload our remaining nukes in downtown Dubai.” As far as I'm concerned, any country that puts people in prison for the “immoral act” of public affection (I'm talking about a man and a woman kissing, not two dudes screwing on the street or anything explicit) deserves every errant cruise missile that happens to eliminate one of their mosques.

Has religion — any religion — ever helped anyone? Doubtful at best. Hell, I'd go so far as to say that religion hurts God. The fact of the matter is the singular issue that religion has been able to unify on and achieve if you look at the whole of human history is the advancement of hatred. Good going Jesus, way to flex those omnipotent muscles. You and Ganesh must be proud of us humans.

Sign me up with Gay Satan, at least he loves the cack and believes in personal freedom.

My mother tried to raise me Anglican — I was even baptized I think — and always wanted to drag us to mass, but thank Dog my father had the common sense to play a lot of Dungeons and Dragons with my brother and I, and make sure the Satanic Bible was left lying around the house.

On a vaguely related note, Attila has been updated and, assuming my code works, now writes a log file (mostly useful for debugging purposes, but also good if you're doing a set of bulk downloads and want to return to the site you got a file from), handles cached files and 302 redirects (ie. less broken downloads), and also does a little bit better skipping of damaged and missing downloads. The new version (v0.91) is at the original download site. If you like it, send me something off my wishlist!

Bug reports are appreciated…