Jeff Makes Software
The software musings of Jeff Putz
-
The ups and downs of templated data-bound controls
I've spent way too much time in the last year writing code for back-end stuff. Now spending quality time with UI is causing me headaches.
Mind you, my problems are relative to my standards, I suppose. Today I was working on the thread display for POP Forums v8. In the past, I would pre-process the data into a DataTable, then bind that to a repeater. I had no problem keeping page rendering times under .10 seconds. Doing that was less pretty, but it very quickly allowed me to build HTML or do empty strings for stuff I didn't want to display.
Using a templated control is much cooler for the tweak monkey that likes to change layout or whatever, but the databinding can be slow when you have to perform some logic or render some nested control. For example, I put a derived Image control in the template that took the member information as a parameter, and if they had no avatar, it set the image's Visible property to false. That nearly doubled the render time of the page!
If I just do a straight bind of a List<Post> object to my control, and just display data from those Post objects, no problem. It's very very fast. I need to rethink the approach a little, because I'm just not happy with the performance.
-
News Corp. buys IGN... wow
The Internet content business has been an interesting one to watch, because not many companies survived. C-Net and IGN are the only real pure-players I can think of. IGN was an interesting one because it grew out of some relatively independent gaming sites.
-
What happened to the Repeater in v2?
As I mentioned in my last post, I'm trying to implement my own data-bound templated control. Everything went pretty swimmingly, as I modeled it quite a bit after a simplified version of Repeater, even using Reflector to see what it does.
However, binding data to each instance of the template was taking about .1 seconds, which is of course completely unacceptable. My first thought was that I was doing something wrong. Then I applied the same data to a Repeater, using the same stuff inside the template. It actually performed slightly worse!
Thinking this was just some kind of crazy fluke, I fired up VS 2003 and tried to do nearly the same thing with a Repeater. Binding data to the old repeater took .001 seconds total, as in, all items combined. WTF?
I'm at a loss to explain this other than to say it's beta software.
EDIT: You know... it was something that I was doing. Duh. I hate it when like a moron I do something stupid and then blame it on the software. I was doing some text parsing on the fly that, to say the least, was not particularly efficient.
-
Why is my data-bound templated control so slow?
I've been working on a templated control, and I'm astounded at how slow it is. I looked at the execution times and narrowed it down to the actual data binding of a particular item...
TemplateItem item = new TemplateItem();
item.DataItem = simpleContainerClass;
ITemplate template;
if (_postTemplate != null)
{
template = _postTemplate;
template.InstantiateIn(item);
this.Controls.Add(item);
}
item.DataBind();
This block of code runs once for each item in the collection of data items in the control's CreatChildControls() method. The TemplateItem class is just a container class with one property called DataItem. The last line, the DataBind() method, takes nearly .1 seconds for each item. That's obviously not acceptable.
Am I missing something here or is there just something slow about using this? I'm using v2 of .NET, by the way.
-
DHTML is a pain in the ass
I have to say that every time I try to do a little DHTML, I start to curse the world. I found a neat little Javascript function that finds the position of an element, which makes it handy to position another element on the page relative to that one.
It works like a champ... in IE. It doesn't work in Firefox. The weird thing is that it doesn't throw any kind of error in the Firefox Javascript console either.
Stuff like this makes it amazing to me that anyone ever gets ajax stuff to work in most browsers.
-
MTV VMA site a big piece of shit
Message to the kids at MTV: When you build a Flash site, it's not an excuse to make navigation suck or to bring even high-end computers to their knees with animation. The 2005 VMA site is a complete piece of shit.
-
I should be podcasting
You know, given my radio and television background, you'd think that I would have been podcasting ages ago. The thing is, I can't think of anything particularly exciting to talk about. I suppose I could do one in conjunction with CoasterBuzz, but God only knows how interesting that might be. I guess it would depend on who I conferenced in, and I wouldn't do it without at least one woman in the mix. That scene is a sausage party as it is.
-
POP Forums getting sexy
I'm really starting to get excited about POP Forums v8 now. It's finally starting to feel like something I could actually use in production. And the part that gets me most excited is that my goal of making it "hackable" is really coming together, with features that other ASP.NET forums don't have. It truly will be a forum for developers that want to work with look and feel on their own terms.
It's also fun to solve new problems. There are little things I've always wanted to implement that you'll find in the various PHP forums out there, but never really got around to it. That stuff is coming together quickly.
And just a side note, I'm really impressed with the generic List<T> collection. I did some performance tests just adding and iterating and it beats the pants off of ArrayList. I realize that's what is supposed to happen, but the tweak monkey in me had to see for myself!
-
Windows Forms n00b question about text boxes
OK, Windows apps are obviously more foreign to me than I thought. Is there some property I'm overlooking for text boxes that, when the user presses enter, will fire a particular button press?
-
What are the kids using to develop with Java on the Mac these days?
What are the kids using to develop with Java on the Mac these days? What the heck, I might be interested in broadening my horizons.