Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: precalculating event dates vs.recalculating them.

by roboticus (Chancellor)
on Jun 23, 2008 at 16:03 UTC ( #693556=note: print w/replies, xml ) Need Help??

in reply to precalculating event dates vs.recalculating them.


Regarding the waste of computational resources: Since you probably care about recurrence only while displaying, why not send the rule to the client, and let some javascript do the recurrence handling? That way, your server totally avoids that particular headache, sending it to the client. That way, only the people wanting to see it pay for it (computationally)....

  • Comment on Re: precalculating event dates vs.recalculating them.

Replies are listed 'Best First'.
Re^2: precalculating event dates vs.recalculating them.
by samtregar (Abbot) on Jun 23, 2008 at 17:34 UTC
    Yow. Imagine if Google took this approach!

    Seriously, this is not a good idea. You'll end up with a site that's basically useless on a low-end machine, and your clients will go elsewhere. Yes, we're just the coders here but let's at least spare a moment to think of the clients!



      Actually, I always keep the clients foremost in my mind when coding. But we are probably imagining two different things. I wasn't intending that JavaScript do something computationally intensive. If the browser is showing a week or month calendar, it seems to me that having a bit of javascript interpret a dozen recurrence items ought not be demanding. But having the server do a dozen recurrence item calculations for tens of millions of customers might be prohibitive. I was imagining that few clients would have very many recurring tasks, and that computing the rules wasn't terribly serious. (I've not written it, but I think I could imagine what the code would basically look like.)

      Having said that, I'm not intending to backpedal. I'm just saying that I don't think it would be very demanding at all (but I've been wrong before). I was simply intending to promote "compute it as you need it" rather than "bulk compute in case you need it".

      • I *only rarely* do web stuff, and haven't written a line of JavaScript in over 10 years. So I really don't know if it's that much of a pig or not.
      • I'm not imagining terribly complicated recurrence rules.
      • I'm anticipating very few customers with very many recurrence rules.
      • And I'm *certainly* not advocating that Google treat our machines as a compute-farm! ;^)
        I'm anticipating very few customers with very many recurrence rules.

        Well in that case why bother? It hardly matters what approach you take if you're not planning for lots of users. Surely your server has the power to compute tons of calender data for just a few users.

        Aside from that, what you're saying almost makes sense... But I have a nagging sense that the case you're presenting isn't actually possible. So much work that your server can't do it, but so little work that you should hand it off to some Javascript to run on the client. I just can't imagine when that would be the case, but perhaps I'm getting too used to having really beefy servers.

        When I think of client processing power I picture my parent's last PC - an Athlon 1800 with 256MB of RAM being slowly choked to death by XP and a collection of useless desktop widgets. The disk was chugging basically constantly during web browsing. Let's just say there wasn't a lot of spare power left for unnecessary Javascript!


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://693556]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2020-05-26 09:08 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (149 votes). Check out past polls.