Stupid Optimizations

One of my priorities for the next FeedDemon has been to fine-tune the “Popular Topics” feature so it’s much faster than it currently is. If you’re subscribed to a lot of feeds that talk about the same topics, it can take several seconds for FeedDemon to build the popular topics page – not painfully slow, but slow enough that you might not use the feature all the time.

And that to me is a problem. See, I’ve been pretty busy for the past couple of weeks and haven’t had time to catch up with my feeds, so I’ve been marking them all read and relying on the popular topics page (along with a few watches) to bring me the latest buzz. It’s been a very useful feature to me lately, so I hate that it’s not as fast as it should be.

I spent several hours ripping through the code and tweaking performance, but it still wasn’t fast enough. I was about to chuck it all and take a different approach when it dawned on me that the problem could be outside the code that builds the popular topics – and sure enough, after profiling the entire codebase I discovered that a crappy routine I wrote long ago which compares two URLs was bogging things down (side note: my routine was pretty bad, but not as bad as the one Dare Obasanjo blogged about).

I spent a few minutes rewriting that routine, and it made an enormous difference. After the initial building of the link database (which occurs the first time you use this feature), displaying the popular topics page now takes less than a second. And changing the filter to show popular topics from today, yesterday, etc., is virtually instantaneous.

When things like this happen, I’m torn between being excited and pummeling myself. I’m pleased that I was able to speed it up, but I’m embarrassed that the performance problem was caused by one stupid piece of code.

15 thoughts on “Stupid Optimizations

  1. Will this change result in a performance increase in other parts of the app?
    In any event – don’t beat yourself up, it serves no good purpose. I mean when I look at some of my early databases….*shudder* – however, I don’t worry about it or feel embarss – I just tell myself that I now excel at my craft and this just PROVES I’m better now than I ever was :)

  2. I think the only reason to beat yourself up is you didn’t profile the entire codebase FIRST, but instead concentrated on what you thought was the problem.
    It’s a critical mistake with speed optimisations, but an easy one to make so don’t worry too much :)

  3. This change shouldn’t boost the performance of other features, since they don’t use URL comparison inside large loops. “Popular Topics” has to compare thousands of URLs for equality, but none of the other features do that.

  4. Yep, you’re right, Andrew (hey, your real name!). I did my initial performance tuning under the false assumption that the problem was within a specific class – I certainly could’ve saved some time if I profiled the entire app first.

  5. Eddy, could you send an email to support-at-newsgator-dot-com describing this problem, and include the URL for the feed shown in the screenshot? That will ensure that this bug is in our tracking system. Thanks!

  6. Nick, I already post the problem in the forums, but the response is always the same:
    * Maybe there is a problem with the feed
    * Maybe you have a bad internet connection (and yes, I know that)
    * Our product is fine, maybe *you* have a problem.
    I bring the topic, not because I want support, but because I believe that you should concentrate your efforts in making FD a superb product, that always work (even with faulty internet connections or feeds with messy GUIDs).
    I don’t say it is easy, but it is more useful that “Popular Topics”.

  7. If it’s that peppy now, maybe this could be an alternate default view instead of the subscriptions overview? Of course, that _would_ mean adding an option… ;)

  8. eddy, because you don’t like the reasons you’re given because the product does not operate the way you like or expect does not give you the right to blatantly ignore the instructions in red at the top of the posting. That shows a distinct lack of respect on your part for Nick.
    This is not the place for bug reports or feature requests. The forums (or an email to support@newsgator.com) are.

  9. Poor old Eddy:-). Without wishing to show a lack of respect for anyone, I am also surprised by the attention and priority that “popular topics” appears to be garnishing at the development level.
    Speed is not an issue for me since the facility is, to all intents and purposes, irrelevent.
    Is 127 feeds too small a quantity to subscribe to, as my “click-on-the-button” searches continually attest? I really have no idea, but please try searching Newsgator/ FeedDemon forums for help on this subject. It’s very name “popular topics,” is asking for problems in this respect.
    I’m not sure whether this facility falls within the general scope of “attention data.” If so, it adds to my overall scepticism about the viability and reliability of such data.
    Andy.

  10. Critter: That’s the kind of attitude (you show me in the forums, and in this thread) that I don’t like.
    I respect Nick very much, and think Nick has the correct attitude attending users concerns, that’s why I bring this topic here.
    I don’t want your “support”, you are not adding value. Thanks!

  11. No, I’m not giving you the answers you want to hear – completely different from “not adding value”. It is obvious from your attitude that “adding value” = “make FD do what I want!”. When you didn’t get a response you liked in the forum, you complained here – blatantly disregarding Nick’s specific request to you to use the support email and completely ignoring the banner above the comment posting form that says “Note: I welcome your comments on this post, but if you have a question about FeedDemon or TopStyle, please submit it in our support forums rather than here.”
    “I respect Nick very much, and think Nick has the correct attitude attending users concerns, that’s why I bring this topic here.” Even though he has already asked you to use the forum and the support email? Yup, I sure can see the respect there…
    With that being said, I will no longer discuss this in this comment, as it was completely offtopic from your initial comment – so you may cast any further barbs you like with impunity.

  12. Wonderfull !!!
    I have been waiting for that … I really like “Popular Topics”.
    I wont sleep till i can use the next FeedDemon Ver. with “Popular Topics” optimized..
    Wonderfull !! Wonderful!! Wond……
    (I AM JUMPING WHILE WRITING THIS, YEAAAAH !!!! )

Comments are closed.