100% found this document useful (1 vote)
31 views

Maximizing NET Performance 1st Edition Nick Wienholt (Auth.) - Get the ebook instantly with just one click

The document promotes the ebook 'Maximizing .NET Performance' by Nick Wienholt, available for download at ebookultra.com. It includes links to additional recommended ebooks and provides an overview of the content and structure of the main book, which covers various aspects of .NET performance optimization. The book aims to help developers understand design issues and CLR mechanisms to enhance application performance.

Uploaded by

riyedxalca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
31 views

Maximizing NET Performance 1st Edition Nick Wienholt (Auth.) - Get the ebook instantly with just one click

The document promotes the ebook 'Maximizing .NET Performance' by Nick Wienholt, available for download at ebookultra.com. It includes links to additional recommended ebooks and provides an overview of the content and structure of the main book, which covers various aspects of .NET performance optimization. The book aims to help developers understand design issues and CLR mechanisms to enhance application performance.

Uploaded by

riyedxalca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Visit https://ebookultra.

com to download the full version and


explore more ebooks or textbooks

Maximizing NET Performance 1st Edition Nick


Wienholt (Auth.)

_____ Click the link below to download _____


https://ebookultra.com/download/maximizing-net-
performance-1st-edition-nick-wienholt-auth/

Explore and download more ebooks or textbooks at ebookultra.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Performance Marketing with Google Analytics Strategies and


Techniques for Maximizing Online ROI 1st Edition Sebastian
Tonkin
https://ebookultra.com/download/performance-marketing-with-google-
analytics-strategies-and-techniques-for-maximizing-online-roi-1st-
edition-sebastian-tonkin/

Active Index Investing Maximizing Portfolio Performance


and Minimizing Risk Through Global Index Strategies 1st
Edition Stvn S.Schonfld
https://ebookultra.com/download/active-index-investing-maximizing-
portfolio-performance-and-minimizing-risk-through-global-index-
strategies-1st-edition-stvn-s-schonfld/

5 Conversations How to transform trust engagement and


performance at work 2nd Edition Nick Cowley

https://ebookultra.com/download/5-conversations-how-to-transform-
trust-engagement-and-performance-at-work-2nd-edition-nick-cowley/

Network Performance Open Source Toolkit Using Netperf


tcptrace NIST Net and SSFNet 1st Edition Richard Blum

https://ebookultra.com/download/network-performance-open-source-
toolkit-using-netperf-tcptrace-nist-net-and-ssfnet-1st-edition-
richard-blum/
Pharmanomics 1st Edition Nick Dearden

https://ebookultra.com/download/pharmanomics-1st-edition-nick-dearden/

Maximizing Return on Investment Using ERP Applications 1st


Edition Weirich

https://ebookultra.com/download/maximizing-return-on-investment-using-
erp-applications-1st-edition-weirich/

Introducing Semantics 1st Edition Riemer Nick

https://ebookultra.com/download/introducing-semantics-1st-edition-
riemer-nick/

Advances in Insect Physiology Vol 29 1st Edition Peter


Evans

https://ebookultra.com/download/advances-in-insect-physiology-
vol-29-1st-edition-peter-evans/

Evil Inventions Nick Arnold

https://ebookultra.com/download/evil-inventions-nick-arnold/
Maximizing NET Performance 1st Edition Nick Wienholt
(Auth.) Digital Instant Download
Author(s): Nick Wienholt (auth.)
ISBN(s): 9781590591413, 1590591410
Edition: 1
File Details: PDF, 7.07 MB
Year: 2004
Language: english
Maximizing .NET
Performance
NICK WIENHOLT

APress Media, LLC


Maximizing .NET Performance
Copyright © 2004 by Nick Wienholt
Originally published by Apress in 2004

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information
storage or retrieval system, without the prior written permission of the copyright owner and the
publisher.
ISBN 978-1-59059-141-3 ISBN 978-1-4302-0784-9 (eBook)
DOI 10.1007/978-1-4302-0784-9

Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.
Technical Reviewer: Simon Robinson
Editorial Board: Dan Appleman, Craig Berry, Gary Comell, Tony Davis, Steven Rycroft, Julian
Skinner, Martin Streicher, Jim Sumser, Karen Watterson, Gavin Wray, John Zukowski
Assistant Publisher: Grace Wong
Copy Editor: Ami Knox
Production Manager: Kari Brooks
Proofreader: linda Seifert
Compositor: Gina Rexrode
Indexer: Michael Brinkman
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski

In the United States: phone 1-800-SPRINGER, email orders@springer-ny .com, or visit


http: 1lwww. springer-ny. com. Outside the United States: fax +49 6221 345229, email
orders@springer. de, or visit http: I lwww. springer. de.

For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219,
Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email info@apress .com, or visit
http: I lwww. apress. com.

The information in this book is distributed on an "as is" basis, without warranty. Although
every precaution has been taken in the preparation of this work, neither the author(s) nor
Apress shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in this work.
The source code for this bookis available to readers at http: I /1<11WW.apress.com in the
Downloads section.
To my wonderful wife, child, and family-
thank you for your love and support
Contents at a Glance
Foreward ..................................................... ..... .xiii
About the Author .................................................. .xv
About the Technical Reviewer ................................... .xvii
Acknowledgments .................................................. .xix
Introduction ..................................................... .xxi
Chapter 1 Introduction ....................................... .1
Chapter 2 Investigating Performance .......................... 9
Chapter 3 Type Design and Implementation .................. .25
Chapter 4 Strings, Text, and Regular Expressions ......... .47
Chapter 5 Collections ....................................... .63
Chapter 6 Language Specifies ............................... .85
Chapter 7 Garbage Collection and Object
Lifetime Management ............................. .101
Chapter 8 Exceptions ........................................ .121
Chapter 9 Security .......................................... .131
Chapter 10 Threading ......................................... .143
Chapter 11 10 and Serialization ............................ .163
Chapter 12 Remoting .......................................... .179
Chapter 13 Unmanaged Code Interoperability ................ .195
Chapter 14 The Common Language Runtime .................... .213
Chapter 15 Solving Performance Problems ................... .235
Appendix Benchmark Test Harness for • NET ............... .249
Index ..................................................... ....... .263

V
Contents
Foreword ..................................................... .... xiii

About the Author ............................................... xv

About the Technical Reviewer .............................. xvii

Acknowledgments ................................................ xix

Introduction .................................................... xxi

Chapter 1 Introduction ...................................... 1


Material Covered .................................................. .2
Solving Specific Performance Problems .......................... .3
Performance and the Development Process ....................... .3
Conclusion ..................................................... ... .8

Chapter 2 Investigating Performance .................... 9


Performance Investigation Patterns ............................ .10
White Box Investigation ........................................ .11
BlackBox Investigation Using the Benchmark Test Harness ....18
Conclusion ..................................................... .. .23

Chapter 3 Type Design and Implementation ............ 25


Reference and Value Types ...................................... .25
Object Allocation and Population .............................. .27
Class Encapsulation ............................................. .31
Implementing Interfaces ......................................... .34
User-Defined Type Conversion ....................................36
Method Modifiers ................................................. .37
Overriding the Equals Method .................................. ..38
GetHashCode Implementation ......................................41
Boxing and Unboxing ............................................. .44
Conclusion ..................................................... .. .44
vii
Contents

Chapter 4 Strings, Text, and


Regular Expressions ........................... 47
Comparing Strings ............................................... .48
String Formatting ............................................... .52
Enumeration ...................................................... .53
String Emptiness ................................................. .53
Intern Pool ...................................................... .54
System. Text. StringBuilder ...................................... .55
Reversing Strings ............................................... .56
Regular Expressions ............................................. .58
Conclusion ....................................................... .62

Chapter 5 Collections ...................................... 63


System.Array ..................................................... .63
System.Collections .............................................. .68
Enumeration ...................................................... .73
Collection Synchronization ..................................... .76
Hashcodes and IHashCodeProvider ............................... .78
Stack Allocation ................................................. .83
Conclusion ....................................................... .84

Chapter 6 Language Specifies ............................. B5


Visual Ba sie . NET ............................................... .87
Managed C++ ...................................................... .95
C# •...............•..•.•.•..•.••.•.••.••••.••.••.•.••.•.••.•....• •• 97
]# .................................................................99
Conclusion ...................................................... .100

Chapter 7 Garbage Collection and


Object Li fetime Management ................. 101
The CLR Garbage Collector .................................... ..101
Unmanaged Resources, Disposal, and Finalization .............104
Optimizing Memory Usage ....................................... .110
P1nn1ng .......................................................... .115
Controlling Process Memory Usage ............................ .. 117
Memory Monitaring Tools ....................................... .118
Conclusion ...................................................... .119

vili
Contents

Chapter 8 Exceptions ...................................... 121


Exceptions and Exception Handling ............................ .122
Proteeted Code Block Handler Efficiency ..................... .122
Execution Interruption ......................................... .123
Proteeted Code Blocks .......................................... .124
Rethrowing Exceptions .......................................... .125
Coding to Avoid Exceptions .................................... .127
Throwing Exceptions ............................................ .127
Moni toring Exceptions .......................................... .129
Conclusion ...................................................... .130

Chapter 9 Security ......................................... 131


Security, Application Design, and Performance .............. .131
CLR Security Model ............................................. .132
Cryptography and Encryption ....................................138
Monitaring Security ............................................ .140
Conclusion ...................................................... .141

Chapter 10 Threading ....................................... 143


Thread Synchronization ......................................... .143
ReaderWriterlock ................................................ .154
Thread Suspension .............................................. .156
Thread Pool ..................................................... .156
Monitaring Threading ........................................... .159
Conclusion ...................................................... .160

Chapter 11 10 and Serialization ........................ 163


IO Performance Background ..................................... .163
Sparse, Compressed, and Memory-Mapped Files ................. .170
Serialization ................................................... .173
Conclusion ...................................................... .177

Chapter 12 Remoting ......................................... 179


Cross-Application Domain Data Movement ...................... .179
Remoting Channel Selection .....................................180
Object Activation .............................................. .183
Calling Methods ................................................. .185
IIS Hosting ..................................................... .187

ix
Contents

Sink Chains ..................................................... .188


Monitaring Remoting ............................................ .193
Conclusion ..................................................... . .194

Chapter 13 Unmanaged Code Interoperability ......... . 195


P/Invoke Calls .................................................. .195
COM •.••.••.•.••.••••.•••••••••••••••••••••••••••.••••••• ••••••••• •203
Managed C++ ..................................................... .208
Monitaring Interop ............................................. .210
Conclusion ..................................................... . .211

Chapter 14 The Common Language Runtime ............... 213


Process Initialization ......................................... .213
Loading Behavior ............................................... .215
Method and Property Inlining .................................. .225
Custom Attributes .............................................. .225
Managing the CLR ............................................... .226
Checked Ari thmetic Code ....................................... .228
Decimal Type .................................................... .230
Debug and Release Builds ..................................... ..230
Managed Application Memory Usage ............................. .231
Reflection ..................................................... . .232
Conclusion ..................................................... . .234

Chapter 15 Solving Performance Problems .............. 235


Task Manager .................................................... .235
Code Profiler ................................................... .238
System Monitor MMC Snap-In (PerfMon) ......................... .240
Memory Profilers ............................................... .243
Below the Source Code .......................................... .244
Third-Party Tools .............................................. .245
Code Rules ..................................................... . .246
Microsoft Product Support Services (PSS) .................... .246
Enterprise Tools ............................................... .247
Conclusion ..................................................... . .248

X
Contents

Appendix Benchmark Test Harness for .NET ........... . 249


Comparing Performance .......................................... .249
Implementing the Benchmark Test Harness ..................... .252
Conclusion ..................................................... . .262

Index ..................................................... ...... . 263

xi
Foreword
"Managed code is too slow. We've got to do this in C++."

-Anonymous

BACK IN 1999, the ACM published a study1 that presented a comparison of 40


independent implementations of a computationally intensive problem, created
by different programmers in either Java-the then-current managed runtime
environment-er C/C++. lt concluded with the finding that interpersonal differ-
ences between the developers "are much larger than the average difference
between Java and C/C++" and that "performance ratlos of a factor of 30 or more
are not uncommon between the median programs from the upper half versus
the lower half."
This should teach you something: Ifyou arenot a guru-level C++ program-
mer, then the chance is quite high that a managed code implementation
performs as well as the average C++ solution-especially given the fact that most
.NET languages simply allow you fewer possibilities to introduce subtle memory-
related or performance-related issues. And keep in mind that this study was
conducted several years ago, and thatJust-In-Time Compilation (JIT) as well as
memory management and garbage collection (GC) technologies have been
improved in the meantime!
This however doesn't mean that you can't create horribly slow, memory eat-
ing applications with .NET. That's why you should be really concemed about the
other part ofthe study's conclusion, namely that "interpersonal differences ...
are much larger." In essence, this means that you have to know about how to
optimize your applications so that they run with the expected performance in a
managed environment. Even though .NET frees you from a Iot of tasks that in
C++ would have been your responsibility as a developer, these tasks still exist;
these "little puppets" have only cleared themainstage and now live in some lit-
tle comer behind the scenes. If you want your application to run in the top
performance range, you will still need to find the right strings to pull to move
these hidden figures and to basically keep them out of the way of negatively
affecting your application's performance.

1. Lutz Prechtelt, "Comparing Java vs. C/C++ Efficiency Differences to Interpersonal


Differences," Communications oftheACM 42, no. 10 (October 1999): 109-112

xili
Foreward

But knowing about the common language runtime's internals is still not
enough, as lots of performance issues actually turn up during application design
and not just during the coding stage. Collections, remoting, interoperability with
unmanaged code, and COM components are not the only things that come to
my mind in this regard.
It is the aim of Nick's book to enable you to understand the design issues as
well as the underlying CLR mechanisms in order to create the programs that run
on the better side ofthe 30-times performance d.ifference quoted in theACM
study. Nick really managed to create a book that addresses these issues, which
will otherwise turn up when carelessly coding to a managed environment. This
book will allow you to get into the details without being overwhelmed by the
underlying complexity of the common language runtime.
The only thing you have to resist after reading the book is the urge to
overoptimize your code. I was delighted to see that Nick begins with a discussion
of identifying an application's performance-critical sections and only later tums
towards isolating and resolving these real performance bottlenecks. This is, in
my opinion, one of the most important tasks-and also one of the most complex
ones-when working with large-scale applications.
And now read on and enjoy the ride to the better side of a 30-fold perfor-
mance difference.

Ingo Rammer, author of Advanced .NET Remoting


Vienna, Austria
http://www.ingorammer.com

xiv
About the Author
Nick Wienholt is a Wmdows and .NET consultant based in Sydney. Nick has
worked on a variety of IT projects over the last decade, ranging from numerical
modeling of beach erosion to financial and payroll systems, with the highly suc-
cessful Passenger Information Display System (PIDS) project that he worked on
as a consultant for Rail Services Australia being a career highlight. PIDS was
developed and installed prior to the Sydney 2000 Olympics and was a key com-
ponent in State Rail's success in moving hundreds of thousands of spectators
during the perlad the Olympic games were held.
Nickis a keen and active participant in the .NET community. He is the
cofounder of the Sydney Deep .NET User group; writes technical articles for
Pinnacle Publishing, Australian Developer Journal, and the Microsoft Developer
Network; is a keen participant in .NET-related newsgroups; and is a regular pre-
senter at technical conferences. An archive of Nick's SDNUG presentations and
articles is available at http: I /WtiW. dotnetperformance. com. In recognition of his
work in the .NET area, he was awarded the Microsoft Most Valued Professional
Award in 2002.
Nick can be contacted at [email protected].

XV
About the
Technical Reviewer
Slmon Robinson is a well-known author specializing in .NET programming,
and is editor of ASP Today, the leading ASP and ASP.NET-related Web site.
Simon's first experience with commercial computer programming was in the
early 1980s wben a computer project be was working on at college became the
college's student timetabling program, running on the BBC Micro. Later on be
studied for a Pb.D. in pbysics, and subsequently spent a couple of years
working as a university pbysics researcber-a large part of this time was spent
writing programs to do mathematical modeling of certain properties of super-
conductors. Somewbere around this time, be realized there was more money
to be bad in straight computer programming, and ended up at Lucent
Technologies doing mostlyWindows COM programming before finally becoming
self-employed, combining writing and freelance software development.
He bas extremely broad experience in programming on Windows. These
days bis core specialism is .NET programming, and be is comfortable coding in
C++, C#, VB, and IL; bis skills range from graphics and Wmdows Forms to
ASP.NET, to directories and data access, to Windows services and the native
WmdowsAPI.
Sirnon lives in Lancaster, U.K. His outside interests include theatre, dance,
performing arts, and politics.
You can visit Simon's personal Web site at http: I IWv~W. SirnonRobinson. com, or
the ASP Today site at http: I IWv~W. asptoday. com.

xvii
Acknowledgments
WRITING A BOOK CAN BE a long and lonely task, and without the constant support
of my wife, this book would never have made it out the door. I am etemally
indebted to her.
To my friends and colleagues in Sydney-Derek, Dan, Sam, Kristie, Troy,
Adam, Helen, and Chuck-many thanks for the conversation, criticisms, and
suggestions. The real-world sounding board that you provided was invaluable.
And finally, to the crew at Apress-Grace, Ami, and Kari on the production
side, Sirnon on technical review, and Dan and Gary on the management side.
Your assistance and support has made this book an immeasurably better
product.

xix
Introduction
LIKE OTHER AREAS OF nonfunetional software produetion, performanee is often
an afterthought to the eonstruetion proeess, and needs to be taeked onto an
existing eode base. With a new platform like .NET, the negative eonsequenees of
this produetion praetiee is more pronouneed, as developers and arehiteets do
not have the same depth of experienee that they did in the unmanaged world. In
the Internet age, produeing software with adequate performanee eharaeteristies
is more important than ever, and in a climate of shrinking IT budgets, throwing
hardware at poorly performing systems is no Ionger an option.
This book aims to arm developers and arehiteets with the knowledge they
need to design and implement software solutions that have great performanee
eharaeteristies on the .NET platform. A familiarity with the .NET Framework is
assumed, and if a reader is new to .NET, there are many wonderful titles from
Apress that ean provide a great introduetion to the platform. For readers who
know .NET and are seeking more advaneed material on the best way to build
performant software, this book has been written for you.
The book ean be read eover-to-eover, or a reader may ehoose to eonsume a
partiewar ehapter in isolation. When eonsuming ehapters in isolation, the reader
is eneouraged to read Chapters 1 and 2, whieh introduee the materials eovered
and lay the groundwork that the following ehapters build upon. Chapters 3
through 14 foeus on performanee issues specifie to a partiewar area of the .NET
Framework, and the material in these ehapters that relies on information in
other ehapters is deliberately highlighted for the reader who ehooses to
approaeh the material nonlinearly.
Chapter 15 presents a troubleshooting guide that aims to provide a system-
atie roadmap for diagnosing and solving performanee problems in .NET
applieations. The ehapter eovers the tools and teehniques that ean be used to
reliably work out why a program is running slowly or eonsuming too mueh
memory, and how the problern ean be solved.
The Appendix eovers the benehmark test harness that was used to eonduet
the benehmarks diseussed throughout the book. For those with an interest in
extending and adding to the benehmarks presented, this material will prove of
great interest.
The souree eode for this book is available from the Apress Web site
(http:/ /www.apress.com), and the reader is eneouraged to download and analyze
this material. The benehmark test harness has been written to allow easy repro-
duetion of the benehmarks refereneed in the book, and experimenting with
these benehmarks is a valuable learning aid. Curiosity is an essential prerequi-
site for understanding performanee, and the souree eode will hopefully provide
the starting point for many new performanee investigations for the reader.

xxi
CHAPTER 1

Introduction
SOFTWARE PERFORMANCE IS A topic rife with paradoxes, confusion, and mystery.
To provide a few examples:

• Processor speed doubles every 18 months, but performance concems


never disappear.

• '!Wo competing software platforms both show order-of-magnitude speed


advantages over the other in benchmarks produced by their respective
vendors.

• Languages and technologies are shunned due to their perceived lack of


performance, but a precise measurement of the slowness is rarely pro-
duced, and the criticism of perceived slowness is discussed even if
performance is not a project priority.

This book attempts to peel back some of the mystery surrounding the per-
formance of code that targets the .NET Framework. The book has two main
goals-to present a detailed discussion on the performance of various .NET
Framework technologies, and to illustrate practices for conducting reliable per-
formance assessment on techniques and methodologies that are not covered in
the book. To address both these goals, every benchmark discussed in this book is
available for download from the publisher's Web site (http: I !WN. apress. com),
and each test is clearly numbered for quick location in the code samples. This
allows for an easy reproduction of the test runs on the reader's own systems, and
also for analysis of the code that makes up the test. Chapter 2 contains a detailed
discussion on conducting performance assessments, and the benchmark har-
ness used to conduct the benchmark results presented is fully documented in
the appendix.
The reader is encouraged to critically analyze the results presented. Service
packs and new versions of the .NET Framework and operatingsystemwill mean
that some of the results presented in this book may differ from those the reader
obtains. In other cases, small changes in a test case can significantly change the
performance of a method, and a test case on a partiewar technology may not
be relevant to other uses ofthe same technology. Subtle changes can bring sig-
nificant performance improvements, and a keen eye for detail is critical.

1
Chapter 1

Material Covered
The focus of this book is .NET Framework performance. The book concentrates
on Framework performance from the ground up, and does not include discus-
sions of higher-level technologies like Wmdows Forms, ASP.NET, and ADO.NET.
These technologies are important, and future volumes may weil be written that
focus on them, but it is critical to appreciate that all.NET code is built on a com-
mon base, which is the focus oftbis book. System-level developers will get the
most out of this book, but every attempt has been made to ensure that the mate-
rial is accessible and relevant to application developers who use higher-level
technologies. By developing a strong understanding of Framework performance,
application developers are in a much better position to identify and avoid per-
formance mistakes in both their own code and high-level application libraries.
Key areas of coverage include the following:

• Analyzing the performance of software systems using black-box and


white-box assessment techniques

• Designing types (classes and structures) so they have optimum perfor-


mance characteristics, and interact efficiently with Framework design
pattems

• Using remoting to build high-performance distributed systems

• Interacting efficiently with unmanaged code using COM Interop,


P /lnvoke, and C++

• Understanding the interaction between performance and language


selection

• Working with the .NET garbage collector to achieve high-performance


object allocations and collections

• Selecting the correct collection class for maximum performance

• Locating and fixing performance problems

Comparison between .NET and competing platforms like J2EE is not covered.
While this information may be of interest to some, cross-technology performance
comparisons are prone to much controversy and conflicting results, as the recent
Pet Shop war between Java vendors and Microsoft demonstrated. At the end of the
day, most cross-technology comparisons are motivated by commercial considera-
tions, and do not assist developers in writing faster and more efficient code on

2
Introduction

either platform. This book is focused on gi.ving developers the information and
tools they need to write high-performance code using the .NET Framework, and
cross-platform sniping wowd only detract from that goal.
For readers interested in independently verified benchmark comparisons
between the afferings of various vendors, the Transaction Processing
Performance Council reswts, available at http: I /www. tpc. org, are an excellent
resource.

Solving Specific Performance Problems


If this book has been purchased to assist with optimization of a section of code
that is taking a long time to complete its task, Chapter 15 is the optimal starting
point. This chapter explores the tools and techniques available for determining
the cause of poorly performing .NET applications, and will assist the reader in
investigating and rectifying a performance problem, even if the specific answer
to the problern is not contained in this book. The remaining chapters cover spe-
cific topics related to the .NET Framework and performance, and attempt to
highlight relevant performance trade-offs, pitfalls, and optimizations for the par-
ticwar technology.

Performance and the Development Process


A structured development process is crucial in producing software with ade-
quate performance characteristics. Regardless of the partiewar development
methodology that an organization follows, it is critical that the development
priorities of the project or product reach the people who actually architect and
develop the software system. In the absence of development priorities, a system
will revert to a partiewar developer or architect's "natural state," and the empha-
sis may be on code readability and maintainability, development speed,
performance, testability, or simply on technology familiarity. Whatever the case,
in the absence of clear communication, it will only be through chance that
developer and project priorities coincide, and such coincidental goal conver-
gence is not likely to happen all that often.
Achieving the correct performance characteristics for a software application
starts during the design phase of a project. If architects and business analysts fail
to provide any guidance regarding performance targets, they showd surrender
their right to criticize the reswt of the development process as slow. Failing to
define or communicate the priorities of a system to the developers and testers
responsible for building the system invariably Ieads to some degree of disap-
pointment with the finished reswt. If this book is being read with a view to
correcting perceived performance problems that are the reswt of an inadequate

3
Chapter 1

software development process, the reader is encouraged to also gain access to


material on software development methodologies. Compensating for poor plan-
ning with post-development tune-ups is a losing battle, and the problern is more
effectively combated further upstream.

Performance Priorities
It is important that some general performance goals are communicated to the
development team before development begins. A development task can fall into
three broad categories of performance priority.

Performance Insensitive
In this mode, performance really does not matter at all. The software can end up
quite slow with no real adverse consequences, and even naive performance mis-
takes are acceptable. Software that fits into this category is typically single- or
special-use, such as a program that will perform a once-off data migration task.
If the software ends up slow, the task can be run on a weekend or on a spare
machine; in this case development time and quality issues are much more
important than speed.
There is nothing inherently wrong with this development mode-in a num-
ber of project types, it is much better for a dient or manager when the software
comes in twice as cheap but ten times as slow. It is important that developers
can swallow their pride in this mode, and appreciate the pressures and priorities
under which the software is being developed.

Performance Sensitive

This is the normal development mode for most applications. In this mode, pro-
ducing software that is "not too slow" is the goal, though other development
priorities may be more important than performance. Producing detailed metrics
that describe how fast "not too slow" is can be hard to achieve, but a few simple
goals can be defined to allow a common understanding of the performance tar-
gets for the application. Forend-user applications, response time and memory
usage are two criteria that are easy for all Stakeholders to understand, and can
be defined as they relate to a target hardware environment. There will usually be
application actions that fall outside the response time goals, and the remedies
required in terms of both the product (for example, adding a progress bar) and
the project (for example, noting the issue in a project manual) should be
defined.

4
Other documents randomly have
different content
is removed. It requires an experienced hand to knead bread without
making it too heavy with flour.

NO. 188. WATER BREAD.


WATER BREAD
2½ quarts of flour,
1 quart of water,
1 tablespoonful of salt,
1½ cakes of compressed yeast.

Place the flour on the hot shelf to get thoroughly warm. Let it be
warm to the hand. Dissolve the yeast in a tablespoonful of water,
and add it, with the salt, to a quart of warm water. Turn the liquid
into the flour, reserving enough flour to use on the molding-board.
Mix it thoroughly. Turn it on to the board and form it into well-
shaped loaves. This quantity of material will make three loaves. Let
it rise in the pans to double in size, which will take about one and a
half hours. Bake for one hour.
This bread is made in about three hours. It is the most simple
receipt possible, and gives excellent results. Some judgment must be
used about the quantity of flour, as it takes a little more or less
according to its dryness.
WHOLE WHEAT BREAD
2½ quarts of whole wheat flour,
1 teaspoonful of salt,
½ cupful of molasses or of sugar,
½ cake of compressed yeast,
About 1 quart of water.

Add the salt to the water. Mix the molasses with part of the water
and with the yeast, which has been dissolved in a little water. Stir
the liquid into the flour, and add enough more water to make a thick
batter. Beat it for some time, or until it is well mixed and the batter
is smooth. Let it rise overnight. Early in the morning stir it down, and
turn it into the pans. Let it rise in the pans to double in size, and
bake for one hour. The above quantities will make two loaves.
NO. 186. BREAD-PAN WITH CLOSE-FITTING COVER.

The cover excludes the air from the dough, so no crust forms while it is rising.

NO. 186. ROUND LOAF AND BAKING TIN.


ROUND LOAF AND BAKING TIN
Any bread mixture may be baked in this pan. The fancy form is its
only recommendation. Round slices are attractive for a change, and
made into toast give also an agreeable variety.
The pan is filled barely half full of dough. It is left to rise for one
hour, and is baked for one hour.

NO. 190. 1. UNLEAVENED BREAD CHIPS. 2. SCOTCH OAT-CAKES.


UNLEAVENED BREAD-CHIPS
Mix into a quart of graham, or of white, or of whole wheat flour
one tablespoonful of butter and one level tablespoonful of salt, then
add about one and a quarter cupfuls of milk and water, half and half,
or enough to make a stiff dough. Flour the molding-board and roll
the mixture thin, fold it together twice and roll it again. Again fold it,
and again roll it very thin. Mark it off, using a pastry-wheel, into
strips one and a quarter inches wide and four to five inches long.
Bake it in a moderate oven for twenty minutes, or until the chips are
cooked through and are brittle, but not very brown.
This bread is recommended for dyspeptics and people of delicate
digestion, on the theory that the yeast-plant is not thoroughly
destroyed when baking bread, and that it continues to ferment in
the stomach.
SCOTCH OAT-CAKES
These cakes should be made of meal ground finer than any we
are able to get in our markets; therefore, one must resort to the
expedient of pounding in a mortar the finest meal obtainable, and
sifting it through a coarse mesh.
Add to one cupful of fine meal one teaspoonful of salt and enough
hot water to make a stiff dough. Sift some of the meal on to the
molding-board, and roll the mixture into a thin cake. Bake it slowly
on a griddle until it is thoroughly dried.

NO. 191. PULLED BREAD.


PULLED BREAD
Take a loaf of freshly baked bread. Cut through the crust around
the loaf at intervals of two inches, then pull the thick slices apart.
Remove the crumb from the crusts, leaving it in ragged pieces. Place
it in a slow oven to color and crisp, turning it often enough to have it
dry and color on every side.

NO. 192. BREAD-PLANE.


THE BREAD-CUTTER
The bread-plane can be adjusted to cut slices of any thickness. It
will cut fresh bread very thin. Bread which is a day old it will cut as
thin as lace. For cutting bread for sandwiches it is especially useful.

NO. 193. LACK TOAST OR ZWIEBACK.


LACE TOAST OR ZWIEBACK
Use stale bread, and with the bread-plane shave off slices as thin
as lace. Spread the slices on pans and place them in the oven for a
minute to brown, or place them on a toaster on top of the range.
It will take but a minute for them to dry and take an even light-
golden color.
This toast can be served with soup, or at any time in place of
cracker biscuits. It is a form of toast much liked by people who do
not eat starchy foods and so abstain from bread.

NO. 194. SWISS ROLLS IN THE DOUGH.


NO. 195. SWISS ROLLS BAKED.
SWISS ROLLS
Scald one cupful of milk to which have been added one
tablespoonful of sugar and two tablespoonfuls of butter. When it has
partly cooled add one half a cake of compressed yeast. Stir in well
about three quarters of a quart of flour. Put it in a moderately warm
place to rise. When it is light, place it in the ice-box for at least three
hours, or overnight. When ready to use, turn the raised dough on a
well-floured board, and roll it to a half-inch thickness. Spread the top
with butter, and roll the sheet of dough like a jelly-cake roll. See
illustration No. 194. Cut from the end of the roll slices three quarters
of an inch in thickness.
Place the slices in pans, leaving plenty of room between each one,
so they will not touch in rising. Let them rise slowly until they are
very light, and more than doubled in size. Bake in a quick oven
about twenty minutes.

NO. 196. LUNCHEON OR DINNER ROLLS AND BRAIDS IN THE DOUGH.


NO. 197. LUNCHEON OR DINNER ROLLS AND TWISTS BAKED.
LUNCHEON OR DINNER ROLLS, BRAIDS, TWISTS
For these rolls, any bread dough may be used. In order to get the
pieces of uniform size, mold the dough into a roll about one and a
half inches in diameter. Cut the roll into pieces one and a half inches
long, giving pieces the size of an egg, or make the pieces larger, if
desired. Turn each piece into a ball, and then, using both hands, roll
it into shape, making a roll which is thick in the center and pointed
at each end. See illustration No. 196.
Place the rolls in pans, giving them sufficient room to rise without
touching. When they have a little more than doubled in size, brush
the tops with beaten egg diluted with a little milk. Bake them in a
quick oven for fifteen or twenty minutes.
For making braids, roll the dough into pencil-shaped pieces about
half an inch in diameter and five inches long. Brush each one with
melted butter. Press the ends of three pieces together and braid
them. Let them rise to double in size, brush the tops with egg and
milk, and bake for fifteen to twenty minutes.
Twists are made the same as braids, using two instead of three
pieces of dough.
NO. 199. STRIPED BREAD AND BUTTER.
STRIPED BREAD AND BUTTER
For First Course with Oysters and Clams on the
Half Shell. For Fish and Salad Courses,
also for Afternoon Tea

Cut white and any kind of brown bread into slices from three
eighths to half an inch in thickness. Spread each slice generously
with butter which is soft enough to spread easily. Lay the slices
together in alternating colors, two buttered sides coming together in
each layer. When the pile of buttered slices is three and a half to
four inches high, cut it into good shape, removing the crusts. Place
the bread between two plates under a light weight and set it into the
ice-box to harden the butter. When ready to serve, cut it into slices
about as thick as the original slices, and then into strips.

NO. 200. CHECKERED BREAD AND BUTTER.


CHECKERED BREAD AND BUTTER
Cut, one inch thick, three slices each of white and of brown bread.
Spread a slice of the white bread with a thick layer of soft butter. Lay
on it a buttered slice of brown bread, placing the buttered sides
together. Cover the top of the brown slice with butter, and lay on it a
buttered slice of white bread, the buttered sides together. You have
now three layers of bread, with the brown slice in the middle.
Repeat the operation, reversing the order of the white and brown
slices. Trim the two piles evenly, and place them in the ice-box under
a light pressure. When the butter is well hardened, cut slices an inch
thick from the ends of both piles. Butter these slices as before,
placing two buttered sides together, and arrange them so that the
colors will alternate in squares.
The hardened butter holds the pieces together, and if the slices
are evenly cut, a checkered square of bread will be the result.
Put the bread and butter under a light pressure in the ice-box, and
when ready to serve cut it into thin slices.

NO. 201. BREAD AND BUTTER SANDWICHES.


1. CIRCLES OF BROWN BREAD WITH NUTS. 2. CIRCLES OF BROWN AND
WHITE BREAD COMBINED.
BREAD AND BUTTER SANDWICHES
It is difficult to butter very thin slices of bread unless the butter is
soft. It is well, when making plain bread and butter sandwiches, to
whip the butter until it is light, soft, and smooth, and then to spread
but one piece of the sandwich. Where filling is used it is not
necessary to butter the bread, as oil or butter is used in the paste.
No. 1. In circles with nuts. Thin slices of buttered Boston brown
bread, or of graham bread, cut with a biscuit-cutter into circles
one and a half inches in diameter. The meat of one half of an
English walnut is placed on the top of each one and held in
place with a little butter.
No. 2. Brown and white bread combined. Cut into circles two
and a half inches or less in diameter thin slices of brown and
white bread. Use a buttered round of brown and of white
bread for each sandwich.

NO. 202. 1. LETTUCE SANDWICHES. 2. ROLLED OR MOTTO SANDWICHES.


ROLLED OR MOTTO SANDWICHES
For rolled sandwiches the bread should be very fresh and moist,
and entirely free from crust. As it is difficult to cut fresh bread with a
knife, use a loaf which is a day old if a bread-plane is not at hand.
Cut it into slices one eighth of an inch thick, using a sharp knife. It
will cut easier if the crust is first removed from the loaf. Arrange the
slices in a pile and cut them all together into good shape. Wrap the
bread in a wet cloth and let it stand in a cool place for two hours.
The bread will then be moist and pliable enough to roll without
breaking. The slices may be simply buttered, or they may be spread
with any mixture desired. If meat or fish is used, it should be
reduced to paste by chopping and pounding, and be well seasoned.
(See “Century Cook Book,” page 364.) Use some butter or oil in the
mixture, so the slices will not need to be buttered. Spread the slices
with the paste and roll them carefully, then roll each one in a piece
of paraffin paper, cut long enough to wrap the sandwich one and a
half times, and wide enough to extend an inch over each end. Twist
the ends of the paper.
Keep the sandwiches in the ice-box until ready to use, and serve
them with the papers on. Wrapped sandwiches will keep fresh for
forty-eight hours. They are especially suitable for travelers and for
picnics.
LETTUCE SANDWICHES
Cut fresh bread into slices a little more than one eighth of an inch
in thickness, using the bread-plane if convenient. Arrange the slices
in a pile, and cut the bread into a shape about four by four and a
half inches. This removes the crusts and leaves all the slices of
exactly the same size. Uniformity in size and shape is one of the
points to observe in making sandwiches. Spread the slices lightly
with butter which is soft enough to spread evenly without tearing
the bread. Place on each buttered slice a leaf of crisp lettuce which
is large enough to extend a little over the ends of the slice, and from
which the midrib has been removed. Sprinkle the lettuce plentifully
with salt. Roll the slices carefully, and tie around each one a piece of
paper the width of the bread.
At the time of serving, this paper is removed and the butter will
then be sufficiently hardened to keep the rolls in shape.
Place the sandwiches on a plate, cover them with a wet napkin,
and keep them in a cool place until ready to serve. In this way
sandwiches may be kept fresh for twenty-four hours.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like