[Building Sakai] org.sakaiproject.util.Web.escapeHtml(String, boolean)

Matthew Buckett matthew.buckett at oucs.ox.ac.uk
Mon May 10 08:55:23 PDT 2010


It seems that org.sakaiproject.util.Web.escapeHtml(String, boolean)
used to lazily allocate the StringBuilder, so that if no escaping was
needed it would just return the same string object. But now it's been
hardcoded to always preallocate the StringBuilder.

			StringBuilder buf = (false) ? null : new StringBuilder();

Does anyone know why this change was made? It seems like it's from
before the K1 days.

This has cropped up as I was looking at the performance of presence
and it makes a reasonable number of calls to this method (eg escape
display names) which generates  quite a few objects that need to be
GCed.

The real performance issue with presence is the cost of the two DB
calls (all sessions in the current site and privacy check to see which
users can be displayed).

-- 
  Matthew Buckett
  VLE Developer, LTG, Oxford University Computing Services


More information about the sakai-dev mailing list