Gretchen and Chris's divorce and a recent article in a Korean newspaper made me think about divorces tonight. In 1980, the divorce rate in Korea was 5.9%. In 1990, 11.4%. Last year, 47.5%. Those who keep track of the numbers say Korea will soon bypass America (51%) if it hasn't already. At this rate, the very social fabric of Korea will soon be torn apart.
I doubt the rate will become 100%, but I can't help but wonder what a society with 100% divorce rate will be like. Our divorce rate with cars is 100% so will we treat our spouses like cars? Will 18 year olds become equivalent of new car models? Will used cars get some respect as classics? What about the equivalent of rental cars? Who is driving who?
While I was looking at the data storage portion of DasBlog for improvements, a low hanging fruit hit me on the forehead: XmlSerializer. XmlSerializer is a major feature of .NET Framework that makes it really easy to read and write data structures from and to XML.
To use XmlSerializer, all you have to do is mark some members of the data structures with .NET attributes — .NET attributes are just source code comments for programs instead of people – that provide hints like this member should be an element and the element name should be such and such.
Ease of use encourages ease of abuse.
XmlSerializer is a rather complex beast so the class takes a while to instantiate. What hit me on the forehead was that DasBlog was using it everywhere and XmlSerializer was being instantiated substantial number of times per request: a juicy low hanging fruit indeed.
So I implemented XmlSerializerFactory which maintains a pool (as in car pool) for XmlSerializer instances and rewired DasBlog to use it whenever it needs an XmlSerializer. There are actually multiple pools because XmlSerializer instances are target data structure specific.
All that took no more than 30 minutes but the result was very rewarding. DasBlog with XmlSerializer pooling was noticeably faster. My guestimate is that it's 20%-30% faster depending on the page type being accessed. Woohoo!
It turns out that .NET 1.1 version of XmlSerializer uses an internal cache already although it depends on which constructor is used. So the speed improvement I saw was either a hallucination or due to some other changes I made.
An irony of the blogosphere is that permalinks are not permanent. Whenever a blog changes service or software, its permalinks breaks. While breaking of permalinks is not worth crying over, it's pretty annoying because internal links break as well.
Unless you are prepared to get your hands dirty, changing blog service or software means you are better off leaving your old posts where they are.
Having your own domain name doesn't protect you either if you decide to switch blogging software. This is why bloggers are leaving a trail of blogs behind them like a breadcrumbs. Nice huh? This is the situation I am in and I did get my hands dirty by writing an ASP.NET HttpModule to redirect date-based Radio URLs to DasBlog's URL format.
It's working pretty well except for the anchor part of URLs which is used by Radio to pinpoint a post in a page containing multiple posts. Since those anchors are not sent to the server, I can't map a Radio URL to a page dedicated to a single post. Oh, well. At least my permalinks are permalinks.
My next task in the blog transition is building a flexible RSS feed service framework while preserving old feed URLs.
I am in the process of moving my blog to a personal mutation of DasBlog. Already moved all the post and comments over but there are lots of changes to make in DasBlog. I chose DasBlog because it gives me a good excuse to play with ASP.NET and it offers relatively easy migration from Radio. It's pretty slow and code itself is not exactly pretty but I can tear into it easily enough. At this point, I am gearing up to replacing its file-based storage with either Berkeley DB XML or MySQL.
Visual design-wise, I am going to be replacing the calendar with tabs to display the blog in daily, weekly, or monthly views. Daily views will show posts spanning days. Weekly view will show post titles spanning weeks. Monthly views will show post titles spanning a year. Search is already there but I'll have to checkout its performance before deciding to replace it or not. And then there is the legacy URL preserving code so old links don't break. Lots of enjoyable headaches ahead.
I am switching ISP as well, so don't be surprised if the blog becomes unavailable for a few days.
I found a wonderful gift for myself today, a nice domain name for a pet project I have been working on: eSignHere.com. It's a great name and it cost me only $7.95 per year. What's is the project about? It's about making e-signing as easy as picking one's nose. Try selling that to your board. Ho Ho Ho!
I really mean it because it doesn't cost me anything. Merry Christmas.
There is something pathetic about getting enthusiastic over a geeky article on Christmas Eve but, if you are a .NET pervert, you should read Aleksandr Mikunov's Rewrite MSIL Code on the .NET Framework Profiling API. The article doesn't say whether the technique still works under .NET 1.1, but it looks promising.
While mutating and hooking managed code is not exactly encourageable behavior, sometimes you have to do it and you can't argue with Gotta.