Index: trac/ticket/api.py
===================================================================
--- trac/ticket/api.py	(revision 6796)
+++ trac/ticket/api.py	(working copy)
@@ -177,6 +177,14 @@
 
     def get_ticket_fields(self):
         """Returns the list of fields available for tickets."""
+        # This is now cached - as it makes quite a number of things faster,
+        # e.g. #6436
+        if self._fields is None:
+            self._fields = self._get_ticket_fields()
+        return self._fields
+
+    _fields = None
+    def _get_ticket_fields(self):
         from trac.ticket import model
 
         db = self.env.get_db_cnx()
@@ -248,6 +256,12 @@
         return fields
 
     def get_custom_fields(self):
+        if self._custom_fields is None:
+            self._custom_fields = self._get_custom_fields()
+        return self._custom_fields
+
+    _custom_fields = None
+    def _get_custom_fields(self):
         fields = []
         config = self.config['ticket-custom']
         for name in [option for option, value in config.options()
