From: Mike Bayer Date: Tue, 16 Sep 2014 15:57:03 +0000 (-0400) Subject: - add differentiating examples of list() vs. iteration X-Git-Tag: rel_1_0_0b1~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9d430af752b7cc955932a54a8f8db18f46d89a6;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - add differentiating examples of list() vs. iteration --- diff --git a/examples/performance/large_resultsets.py b/examples/performance/large_resultsets.py index 0a5857b75b..fbe77c759a 100644 --- a/examples/performance/large_resultsets.py +++ b/examples/performance/large_resultsets.py @@ -52,12 +52,18 @@ def setup_database(dburl, echo, num): @Profiler.profile -def test_orm_full_objects(n): - """Load fully tracked objects using the ORM.""" +def test_orm_full_objects_list(n): + """Load fully tracked ORM objects into one big list().""" + + sess = Session(engine) + objects = list(sess.query(Customer).limit(n)) + + +@Profiler.profile +def test_orm_full_objects_chunks(n): + """Load fully tracked ORM objects a chunk at a time using yield_per().""" sess = Session(engine) - # avoid using all() so that we don't have the overhead of building - # a large list of full objects in memory for obj in sess.query(Customer).yield_per(1000).limit(n): pass