8,95 €
8,95 €
inkl. MwSt.
Sofort per Download lieferbar
payback
4 °P sammeln
8,95 €
8,95 €
inkl. MwSt.
Sofort per Download lieferbar

Alle Infos zum eBook verschenken
payback
4 °P sammeln
Als Download kaufen
8,95 €
inkl. MwSt.
Sofort per Download lieferbar
payback
4 °P sammeln
Jetzt verschenken
8,95 €
inkl. MwSt.
Sofort per Download lieferbar

Alle Infos zum eBook verschenken
payback
4 °P sammeln
  • Format: PDF

This short cut focuses on a number of coding patterns that are useful when trying to get maximum speed out of performance-critical sections of Ruby code. Anti-patterns, that is, coding idioms, which should be avoided in performance-sensitive code sections are discussed, including details on how to transform such code to make it more efficient. Most patterns were extracted from Stefan Kaes' work on improving performance of the Rails core and his regular Rails performance consulting work. These patterns are largely non-algorithmic, detailing local code transformations to achieve identical…mehr

Produktbeschreibung
This short cut focuses on a number of coding patterns that are useful when trying to get maximum speed out of performance-critical sections of Ruby code. Anti-patterns, that is, coding idioms, which should be avoided in performance-sensitive code sections are discussed, including details on how to transform such code to make it more efficient. Most patterns were extracted from Stefan Kaes' work on improving performance of the Rails core and his regular Rails performance consulting work. These patterns are largely non-algorithmic, detailing local code transformations to achieve identical results with slightly different and faster code, as even local code changes can sometimes result in orders of magnitude improvements. Some patterns are useful independent of Rails' implementation language, but some of them are specific to Ruby, or more specifically, the current implementation of Ruby. Converts from other languages, especially from statically typed languages such as Java or C++ may find this material useful, as the performance characteristics of certain operations, like performing a function call or accessing object fields/attributes, are quite different from what you expect.

What This Short Cut Covers

Introduction

Ruby's Interpreter Is Slow

Runtime Complexity of Ruby Language Constructs

Patterns



Instance Variables versus Accessors

Local Variables Are Cheap

Assignments in Expressions

Interpolated Strings

In-Place Updates

Sets versus Arrays

For Loops versus each

Make Decisions at Load Time

Self Modifying Code

Test Most Frequent Case First

Optimize Access to Global Constants

Caching Data in Instance Variables

Caching Data in Class Variables

Coding Variable Caching Efficiently

Initializing Variables with nil

Using .nil?

nil? or empty? versus blank?

Using return

Using returning

Using any?

Block Local Variables

Date Formatting

Temporary Datastructure Constants

File System Access

ObjectSpace.each_object

Unnecessary Block Parameters

Symbol.to_proc

Chained Calls of map

Requiring Files Dynamically

Including Modules versus Opening Classes



About the Author


Dieser Download kann aus rechtlichen Gründen nur mit Rechnungsadresse in A, B, BG, CY, CZ, D, DK, EW, E, FIN, F, GR, HR, H, IRL, I, LT, L, LR, M, NL, PL, P, R, S, SLO, SK ausgeliefert werden.

Autorenporträt
Dr. Stefan Kaes led Rails' core team effort to achieve acceptable performance for the 1.0 release. Stefan is a software consultant in Germany and previously taught programming at the Technical University of Darmstadt. He regularly contributes patches to Rails core and has a successful Rails performance blog, http://railsexpress.de/blog/. In January 2005 he discovered Rails by accident, learned Ruby in about a week, and became convinced this is the right way to develop web applications due to the simplicity, flexibility, and power achieved by the combination of the Rails design and Ruby's language characteristics.