mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-02 13:59:02 -04:00
165609a190
reimplementing the highest impact functions. The actual speedups will depend heavily on your DBAPI and the mix of datatypes used in your tables, and can vary from a 50% improvement to more than 200%. It also provides a modest (~20%) indirect improvement to ORM speed for large queries. Note that it is *not* built/installed by default. See README for installation instructions. - The most common result processors conversion function were moved to the new "processors" module. Dialect authors are encouraged to use those functions whenever they correspond to their needs instead of implementing custom ones.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from sqlalchemy import *
|
|
from sqlalchemy.test import *
|
|
|
|
NUM_FIELDS = 10
|
|
NUM_RECORDS = 1000
|
|
|
|
class ResultSetTest(TestBase, AssertsExecutionResults):
|
|
__only_on__ = 'sqlite'
|
|
|
|
@classmethod
|
|
def setup_class(cls):
|
|
global t, t2, metadata
|
|
|
|
metadata = MetaData(testing.db)
|
|
t = Table('table', metadata, *[Column("field%d" % fnum, String) for fnum in range(NUM_FIELDS)])
|
|
t2 = Table('table2', metadata, *[Column("field%d" % fnum, Unicode) for fnum in range(NUM_FIELDS)])
|
|
|
|
def setup(self):
|
|
metadata.create_all()
|
|
t.insert().execute(
|
|
[dict(("field%d" % fnum, u"value%d" % fnum)
|
|
for fnum in range(NUM_FIELDS)) for r_num in range(NUM_RECORDS)]
|
|
)
|
|
t2.insert().execute(
|
|
[dict(("field%d" % fnum, u"value%d" % fnum)
|
|
for fnum in range(NUM_FIELDS)) for r_num in range(NUM_RECORDS)]
|
|
)
|
|
|
|
def teardown(self):
|
|
metadata.drop_all()
|
|
|
|
@profiling.function_call_count(14416, versions={'2.4':13214, '2.6+cextension':409})
|
|
def test_string(self):
|
|
[tuple(row) for row in t.select().execute().fetchall()]
|
|
|
|
# sqlite3 returns native unicode. so shouldn't be an
|
|
# increase here.
|
|
@profiling.function_call_count(14396, versions={'2.4':13214, '2.6+cextension':409})
|
|
def test_unicode(self):
|
|
[tuple(row) for row in t2.select().execute().fetchall()]
|
|
|