Permalink
Browse files

Add major speedup to Dataset#map, #to_hash, #select_map, #select_orde…

…r_map, and #select_hash

Previously, sequel_pg only modified the internals of #fetch_rows,
which is the most important method as all other retrieval goes
through it.  However, the #map, #to_hash and related methods are
inefficient in Sequel, as they build a temporary hash for each
row, only to throw each temporary hash away.  This commit optimizes
these methods to not create the temporary hash, by having fetch_rows
return a number of different types (e.g. single values, arrays of
values, only a single hash).  In my testing, there is about a 2x
speedup using these optimized methods over the previous case where
only fetch_rows was optimized, and only a very small performance
hit for the general usage of fetch_rows.
  • Loading branch information...
1 parent aa79f71 commit b317ac7b377c0c5210e970146a402b321f14f5a7 @jeremyevans committed Oct 8, 2011
Showing with 323 additions and 70 deletions.
  1. +1 −1 .gitignore
  2. +2 −0 CHANGELOG
  3. +1 −1 Rakefile
  4. +275 −67 ext/sequel_pg/sequel_pg.c
  5. +43 −0 lib/sequel_pg/sequel_pg.rb
  6. +1 −1 sequel_pg.gemspec
View
@@ -4,6 +4,6 @@
/ext/sequel_pg/1.*
/pkg
/tmp
-/lib
+/lib/*.so
*.gem
*.rbc
View
@@ -1,5 +1,7 @@
=== HEAD
+* Add major speedup to Dataset#map, #to_hash, #select_map, #select_order_map, and #select_hash (jeremyevans)
+
* Work with the new Database#timezone setting in Sequel 3.29.0 (jeremyevans)
=== 1.1.1 (2011-09-01)
View
@@ -5,7 +5,7 @@ CLEAN.include %w'**.rbc rdoc'
desc "Do a full cleaning"
task :distclean do
- CLEAN.include %w'tmp pkg sequel_pg*.gem lib'
+ CLEAN.include %w'tmp pkg sequel_pg*.gem lib/*.so'
Rake::Task[:clean].invoke
end
Oops, something went wrong.

0 comments on commit b317ac7

Please sign in to comment.