Prev | Current Page 244 | Next

Brad Ediger

"Advanced Rails"

13935 42.79449 2.3 2.3 431.39 427.94 1.01
all requests 43.13935 42.79449 2.3 2.3 431.39 427.94 1.01
This change only resulted in a performance gain of 1%, which is probably not worth
pursuing for performance??™s sake alone. (In this case, the code under question was in
desperate need of a rewrite, so this was a net gain anyway.)
We should also compare the actual ranges that the trial times fall into, to be sure that
these results have statistical significance. To visualize this, I instrumented the Railsbench
PerfInfo class to show the actual trial times (not just the mean and standard
deviation), and piped the data through R.* The result is shown in Figure 6-5.
This box-and-whisker plot shows the median value (the heavy line), the first and
third quartile (into which the middle half of the data points fall; represented by the
box), and the complete range (the brackets). From this, we see that the first optimization
was a clear winner; the ranges of values do not even overlap.
The second optimization is not as clear-cut; there is still significant overlap between
the two ranges of observations. If there is any performance gain, it is likely marginal,
as it is overshadowed by the inherent variability of the response times.
* R (http://www.r-project.org/) is a language for statistical computing.
ActiveRecord Performance | 165
ActiveRecord Performance
Object-relational mapping systems provide such a high-level environment for working
with data that it is easy to forget about efficiency until it becomes a problem.


Pages:
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256