Too many tokens, life's bad !

Babas,
I was persistently facing a problem. When I used to go to add content types or edit content types, I had to wait for long,long and long and long...The page would pretend to load..but could not load...After sometime my browser used to cry and crash. I didn't know whats was causing the problem until today. Entity tokens & token module causes the problem.Entity tokens and tokens provides lots and lots and lots of tokens. These modules recursively builds the token tree for its widget, which can become increasingly huge the more chained token possibilities you have - and this is exactly what you get if you have many reference fields.

For example let's say there are 100 tokens for a node. If we have 10 node references ,there will be 100x10 tokens in the next level - so on the fourth level we would have 100x(10^4) tokens. Of course this eats lots of memory as lots of token are loaded.

I was checking real time memory status(using htop command) while I clicked on add content type link..I noticed memory size increasing from 700 to 1900 MB. This makes the site very slow. Solution is just a module away, The ninja module is called Token Tweak which allows us to limit the depth of token tree (http://drupal.org/project/token_tweaks). Limiting the depth loads only required tokens and loading is faster . This module has made my life better. Now all those links that contains tokens open is seconds :). My browser is happy :) Token Tweaks rocks!!

Technologies: