Advanced Rails - Building Industrial-Strength Web Apps in Record Time
Ruby’s Environment | 145 Another typical example of SQL injection is a query such as “'OR1=1;--”, which yields: SELECT * FROM pe ...
146 | Chapter 5: Security The message passed in to that method will always be the third parameter tosvn,no matter what kind of s ...
147 Chapter 6 CHAPTER 6 Performance 6 Premature optimization is the root of all evil (or at least most of it) in programming. —D ...
148 | Chapter 6: Performance Measurement Tools Of course, in order to properly measure performance, we need tools. This section ...
Measurement Tools | 149 This gives us predictable results: samples.sum # => 53.0 samples.length # => 5 samples.mean # => ...
150 | Chapter 6: Performance As our data set represents application response times, from which we want to infer a mean and confi ...
Measurement Tools | 151 We see that the server that produced the first set of samples will usually (95% of the time) respond in ...
152 | Chapter 6: Performance else super end end end t = Test.new Benchmark.bmbm do |b| b.report("Direct method call") do 1_000_0 ...
Measurement Tools | 153 Don’tjust go poking around looking for code to benchmark, though. Profilers are much more powerful utili ...
154 | Chapter 6: Performance 3.92 0.35 0.02 89 0.22 0.45 Array#each_index 3.92 0.37 0.02 89 0.22 0.34 Inflector.humanize 1.96 0. ...
Rails Optimization Example | 155 The IOTail library mixes in atail_linesmethod toIOandStringIO. This method yields once for each ...
156 | Chapter 6: Performance First, we need to install the ruby-prof gem: $ sudo gem install ruby-prof We need to write an integ ...
Rails Optimization Example | 157 The meaning of theCallscolumn is different for different rows. For the primary row within a blo ...
158 | Chapter 6: Performance Optimizing and Reprofiling Now, we will examine the profile to find areas of our code that are slow ...
Rails Optimization Example | 159 Now, we may want to examine the source of these calls todecode_hex. This function has only one ...
160 | Chapter 6: Performance end # Invalidate cache when new location is assigned def location=(val) @location_geometry = @locat ...
Rails Optimization Example | 161 3.64 0.40 0.39 0.00 0.01 133960 Hash#[]= 3.55 0.70 0.38 0.00 0.32 1040 GeoRuby::SimpleFeatures: ...
162 | Chapter 6: Performance The benchmarking tool we will be using is Railsbench (http://railsbench.rubyforge.org/) by Stefan K ...
Rails Optimization Example | 163 There is one last change we must make. By default, all Rails environments except pro- duction h ...
164 | Chapter 6: Performance $ perf_comp a/perf_run.searches_create.txt b/perf_run.searches_create.txt perf data file 1: a/perf_ ...
«
4
5
6
7
8
9
10
11
12
13
»
Free download pdf