Commit 2407329
committed
Optimize Dataset#all and #with_sql_all
This allocates an array with the expected size up front, and avoids
a C -> Ruby call per row.
Instead of checking whether Sequel::Model::ClassMethods is already
defined during load, check it inside optimize_model_load. This
allows for optimization in the case where sequel/core is required,
then the database is setup, and then sequel is required.
However, this approach also results in unnecessary slowdown of
Dataset#each when models are not used. An alternative approach will
be used in a future commit to avoid this.1 parent 96fc41e commit 2407329
File tree
3 files changed
+78
-19
lines changed- ext/sequel_pg
- lib/sequel_pg
3 files changed
+78
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
1470 | 1474 | | |
1471 | 1475 | | |
1472 | 1476 | | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
1473 | 1481 | | |
1474 | 1482 | | |
1475 | 1483 | | |
| |||
1760 | 1768 | | |
1761 | 1769 | | |
1762 | 1770 | | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1763 | 1800 | | |
1764 | 1801 | | |
1765 | 1802 | | |
| |||
2083 | 2120 | | |
2084 | 2121 | | |
2085 | 2122 | | |
| 2123 | + | |
| 2124 | + | |
2086 | 2125 | | |
2087 | 2126 | | |
2088 | 2127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
102 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
103 | 121 | | |
| 122 | + | |
104 | 123 | | |
105 | 124 | | |
106 | 125 | | |
| |||
153 | 172 | | |
154 | 173 | | |
155 | 174 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
160 | 179 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
168 | 186 | | |
169 | 187 | | |
170 | 188 | | |
| |||
0 commit comments