var ctx = SP.ClientContext.get_current(); var session = SP.Taxonomy.TaxonomySession.getTaxonomySession(ctx); var termSet = session.getDefaultSiteCollectionTermStore().getTermSet(setGuid); var terms = termSet.getAllTerms(); ctx.load(terms,'Include(Id,Name,IsRoot,LocalCustomProperties,CustomSortOrder,Parent.Id)'); executeQueryAsync(ctx);
The code works and gets the values we need. When I was first developing this on a test termset it took about 45 to 80 milliseconds to retrieve the data. Then when we switched to our actually site termset it exploded to 6 to 9 seconds! Which of course wasn't good because users don't know to wait up to 9 seconds before the navigation appears.
In an extensive debugging session (and much hair pulled out of my head) I discovered the reason. Under the Intended use tab for the term set I had turned off the Available for Tagging.
With available for tagging turned off the same call takes approximately 1000 times longer than it does if available for tagging is checked.
Can anyone provide clues to why this should be the case?
For this use we don't need the set to be available for tagging, but it won't hurt. But what if we couldn't turn it on? Would we just have to live with 1000 times longer calls?