Ajax is slow, I'm not sure if there's a model for preloading that I especially like, but some preloading is necessary I think.

Comments

Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Priority: Normal » Minor
Status: Active » Postponed (maintainer needs more info)

I go a step further: client-side caching. See http://drupal.org/node/284638 and http://drupal.org/node/300572
HTML 5 client-side databases are already supported! Unfortunately, this has only been implemented in Safari/WebKit so far.

Also, AJAX isn't slow. It isn't very noticeable and definitely not annoying at http://wimleers.com/demo/hierarchical-select/taxonomy (there it takes about 0.5 second). So probably it's your server that's too slow … or you've got a huge taxonomy, in which case it might indeed be slow.
So, do you have a huge taxonomy?

Flying Drupalist’s picture

My site has it at the same speed as yours, but when everything else happens instantaneously, and when my hierarchy is deep, even this little delay is annoying as heck and causes users to complain.

I do think there should be some kind of server-side precache, I know about the client side caching, but there should be more. {erhaps the tax should be cached on cron run, and only refreshed if a new term is added.

Wim Leers’s picture

Assigned: Wim Leers » Unassigned

Ah well, yes, you could create a server-side cache. I'd recommend altering the hs_taxonomy_hierarchical_select_children() function in the hs_taxonomy.module file and add caching in there. Then post the patch here and post the statistics of the improvements.

Wim Leers’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing while cleaning up the issue queue. Feel free to reopen.

Flying Drupalist’s picture

Status: Closed (fixed) » Active

I still can't do this, but I'm going to open it anyway.

I'm no longer sure if it makes sense to have a server side cache, I think even if it's based on cron it has possibilities for syncing poorly.

What makes most sense to me is selectable levels of preloading. So whenever a term is selected, the next 2 levels are ajax loaded as soon as initial loading is complete.

Wim Leers’s picture

Status: Active » Postponed (maintainer needs more info)

That'll result in even worse performance. Suppose you have 15 items in the next level. You want to load the next 2 levels. That means 16 subtrees will have to be retrieved.

Client-side caching (as said, #284638: New cache system: JS and #300572: New cache system: Google Gears) make much more sense.

Flying Drupalist’s picture

How would it impact performance? The page is already loaded. It'll just make future loading faster.

Wim Leers’s picture

Title: Preload choices » Preload choices: revamp HS' cache system
Priority: Minor » Normal
Status: Postponed (maintainer needs more info) » Active

True. My wording was somewhat unfortunate. The loading of the page would take very, very long. But of course, you could use a server-side cache system as you suggested. But then the problem is the syncing with the client-side cache, as you also said. However, it's possible to work around that, by making the client-side cache system smarter.

Let's make this an umbrella issue :)

From my POV, the requirements are:
- We want to be able to have a server-side cache when the hierarchy is not too big.
- Each HS implementation must be able to tell the server-side cache when it should update a subtree.
- We want to be the client-side cache to update automatically whenever the server-side cache has been updated.
- The client-side cache must not be invalidated completely, each subtree must be updatable separately.

Comments?

Flying Drupalist’s picture

Thanks for prioritizing this issue. :)

Your plans sound great. I hope it'll be enough to fix the speed issue though.

Wim Leers’s picture

Title: Preload choices: revamp HS' cache system » Performance: revamp HS' cache system
Wim Leers’s picture

Issue tags: +Performance

This is a performance feature.

Wim Leers’s picture

Status: Active » Postponed

And will not be for HS 3.0 for D6.

Wim Leers’s picture

Instead of writing code for Client-side databases, Google Gears and whatnot, use jQuery jStore instead, which provides an abstraction for all of these: http://code.google.com/p/jquery-jstore/.

Wim Leers’s picture

In addition to the explanation in #8:

Using a scheme like:
* invalidate the entire cache of a hierarchy if changes are made on the vocabulary settings page
* when a term is changed, invalidate the tree below it
* when a term is added, invalidate the tree above it

As mentioned in http://drupal.org/node/235932#comment-827377.

(Source: #253301: Client-side cache: more advanced cache invalidation.)

Wim Leers’s picture

And JSON requests should be made cacheable (original issue: #228174: Make JSON requests cacheable).

robby.smith’s picture

I have 1000+ terms and each term is under multiple parents (5-10 multiple parents).
It takes awhile for a selection to load. I hope this will fix this performance issue. Thanks!

crea’s picture

Subscribing

crea’s picture

As advancement of #544324: Performance: Improve multiple item processing in big taxonomy hierarchy setups. we can also make server-side cache for processed data of HS hooks: rendered children, children count etc.

tayzlor’s picture

subscribing

neochief’s picture

Subscribing.

Wim Leers’s picture

Issue tags: +HS4

Tagging for HS4. Will be included in the HS4 roadmap: http://drupal.org/node/1052670.

klonos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev

This will happen in the 7.x branch.

joelpittet’s picture

Issue summary: View changes
Status: Postponed » Active

This may not happen but I don't think being in postponed will help it. setting back to active if people are planning on working on it. Or maybe close it?