This project is archived and is in readonly mode.

#4191 ✓resolved
James Golick

Performance improvements to multibyte utils

Reported by James Golick | March 16th, 2010 @ 05:01 PM | in 3.0.2

In the 2-3-stable branch, the ActiveSupport::Multibyte.clean() was doing this:

stripped = []; for c in string.split(//)
  stripped << c if expression =~ c
end; stripped.join

That was creating tons of garbage. Actually, it was the single biggest creator of garbage in our requests (around 4500-6000 objects).

It was replaced with

string.split(//).grep(expression).join

...in master, which reduces the amount of garbage by about 70%. I backported that change to 2-3-stable:

http://github.com/jamesgolick/rails/commit/ff2f98173d398cc40f5d6e2f...

And I also added a patch of my own to reduce the amount of garbage in ActiveSupport::Multibyte.verify():

http://github.com/jamesgolick/rails/commit/eb96874f97b8e11f37f9c6c7...

and backported that too:

http://github.com/jamesgolick/rails/commit/69a5cad7f7c7d6f7498dd87a...

Comments and changes to this ticket

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages