In my current project, the user profile contains five node references and two content types have node references to three other content types. The token tree grows exponentially when Entity Tokens (providing field tokens!) is enabled. The token tree max depth stops it from rendering infinity, but the damage is already done on the Account Settings page (admin/config/people/accounts). The Token Tree UI tables are loaded five times and the resulting HTML is 42 megabytes. I can upload an example if needed, but it isn't difficult to reproduce.
This issue causes Drupal to use excessive ram, CPU (server for PHP, and client for JS), and bandwidth, creating many types of crashes. Workaround is the patch I wrote in: http://drupal.org/node/1058912#comment-4830326 I'd rather not fix it that way though. The only correct fix I see at this point is #1229568: Token UI 2.0 getting changed to "Token UI 1.0". Other ideas?
Comments
Comment #1
gmak commentedI can confirm that I am facing the same issue. The Token Tree UI tables become so large that they stall the browser while it tries to process.
Comment #2
geerlingguy commentedDitto.
Comment #3
dave reidWe already have:
#1058912: Prevent recursive tokens
#1068990: Optimize and add caching for theme_token_tree()
#1256524: Only output token tree on user account settings page once
I'm marking this as a duplicate of all three. To improve the JS performance, file an issue with the jQuery treeTable library at https://github.com/ludo/jquery-treetable
Comment #4
13rac1 commented@Dave Reid according to your comment in #1058912: Prevent recursive tokens this problem should be a separate issue: http://drupal.org/node/1058912#comment-4878408
Even with caching to theme_token_tree, no recursive tokens, and a single token tree, the account settings page HTML is over 8 megabytes. Asking the treeTable library to quickly parse a 8MB token table isn't reasonable, so that isn't a JS performance problem. The problem is supplying the huge table in the first place.
Comment #5
dave reidYes and limiting the tree depth is not an option for the module itself. The problem itself is that you are using the Entity tokens module which creates a huge flood of tokens that as the code of the tree table I wasn't prepared or designed for. Simply using that module and the number of tokens it creates is *not* something I can support. Doing Field tokens the proper way would have addressed this issue in the proper way.
Without Entity tokens there is only one treeTable on the account settings page. With a couple of fields the size of the treeTable is 156KB only. With even more fields that wouldn't be much larger.
Simply, if your issue isn't partially addressed by the linked issues, then there is nothing more I can do for a module I cannot support (Entity tokens).