JSMath is a pretty old js library that caused issues many times. The new library used for this is MathJax. Besides LateX input, MathJax can also render MathML XML elements. It is under active development while JSMath is not maintained anymore. A switch is inevitable.
@Stéphane: See attached patch, maybe it speeds up things. The patch is from 2010 when I already implemented this, so way to directly apply it. At this time we decided against the patch as we found MathJax not stable enough.