Massive speedup of quote_string for mysql
-----------------------------------------

                 Key: JRUBY-2205
                 URL: http://jira.codehaus.org/browse/JRUBY-2205
             Project: JRuby
          Issue Type: Improvement
          Components: ActiveRecord-JDBC
            Reporter: Tomasz Wegrzanowski
         Attachments: 
activerecord_jdbc_mysql_quote_string_on2_to_on_performance_fix.patch

JDBC ActiveRecord Mysql adapter's quote_string was O(n^2) [O(string length * 
number of special characters)
to be more exact], and therefore very slow. It became a bottleneck for a Rails 
app I'm working on after I fixed the
previous base64 slowness bottleneck. This patch completely fixes the problem 
making quote_string O(n).

The problem doesn't affect MRI ActiveRecord Mysql adapter. Similar problems 
might affect other
adapters in JDBC ActiveRecord, but I haven't looked at them.

I don't have any extracted benchmark that doesn't depend on having database 
connection,
but saving a record to mysql database with field containing ("\n" * 1_000_000) 
should take a couple
orders of magnitude less after the patch than before the patch.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to