#1645 new
Sergiu Dumitriu

Performance improvement by reusing the ScriptFragment RegExp object

Reported by Sergiu Dumitriu | January 8th, 2013 @ 09:47 PM

Doing some performance debuggin on a page that enhances (using update(...)) about 1000 elements, I noticed that on Chrome[ium] a lot of time is spent in the stripScripts method. I tried to replace the new RegExp(Prototype.ScriptFragment, 'img') call with a singleton instance of the regular expression, and I noticed that the overall performance of the script improved from 4s to 3s. Firefox doesn't seem to be affected (it probably caches the RegExp object automatically).

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket