Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Cover
Title
Copyright
Dedication
Contents at a Glance
Contents
Foreword
About the Authors
About the Technical Reviewers
Acknowledgments
Introduction
Chapter 1: Performance Metrics
Performance Goals
Performance Metrics
Summary
Chapter 2: Performance Measurement
Approaches to Performance Measurement
Built-in Windows Tools
Performance Counters
Event Tracing for Windows (ETW)
Time Profilers
Visual Studio Sampling Profiler
Visual Studio Instrumentation Profiler
Advanced Uses of Time Profilers
Allocation Profilers
Visual Studio Allocation Profiler
CLR Profiler
Memory Profilers
ANTS Memory Profiler
SciTech .NET Memory Profiler
Other Profilers
Database and Data Access Profilers
Concurrency Profilers
I/O Profilers
Microbenchmarking
Poor Microbenchmark Example
Microbenchmarking Guidelines
Summary
Chapter 3: Type Internals
An Example
Semantic Differences between Reference Types and Value Types
Storage, Allocation, and Deallocation
Reference Type Internals
The Method Table
Invoking Methods on Reference Type Instances
Sync Blocks And The lock Keyword
Value Type Internals
Value Type Limitations
Virtual Methods on Value Types
Boxing
Avoiding Boxing on Value Types with the Equals Method
The GetHashCode Method
Best Practices for Using Value Types
Summary
Chapter 4: Garbage Collection
Why Garbage Collection?
Free List Management
Reference-Counting Garbage Collection
Tracing Garbage Collection
Mark Phase
Sweep and Compact Phases
Pinning
Garbage Collection Flavors
Pausing Threads for Garbage Collection
Workstation GC
Server GC
Switching Between GC Flavors
Generations
Generational Model Assumptions
.NET Implementation of Generations
Large Object Heap
References between Generations
Background GC
GC Segments and Virtual Memory
Finalization
Manual Deterministic Finalization
Automatic Non-Deterministic Finalization
Pitfalls of Non-Deterministic Finalization
The Dispose Pattern
Weak References
Interacting with the Garbage Collector
The System.GC Class
Interacting with the GC using CLR Hosting
GC Triggers
Garbage Collection Performance Best Practices
Generational Model
Pinning
Finalization
Miscellaneous Tips and Best Practices
Summary
Chapter 5: Collections and Generics
Generics
.NET Generics
Generic Constraints
Implementation of CLR Generics
Collections
Concurrent Collections
Cache Considerations
Custom Collections
Disjoint-Set (Union-Find)
Skip List
One-Shot Collections
Summary
Chapter 6: Concurrency and Parallelism
Challenges and Gains
Why Concurrency and Parallelism?
From Threads to Thread Pool to Tasks
Task Parallelism
Data Parallelism
C# 5 Async Methods
Advanced Patterns in the TPL
Synchronization
Lock-Free Code
Windows Synchronization Mechanisms
Cache Considerations
General Purpose GPU Computing
Introduction to C++ AMP
Matrix Multiplication
N-Body Simulation
Tiles and Shared Memory
Summary
Chapter 7: Networking, I/O, and Serialization
General I/O Concepts
Synchronous and Asynchronous I/O
I/O Completion Ports
NET Thread Pool
Copying Memory
Scatter–Gather I/O
File I/O
Cache Hinting
Unbuffered I/O
Networking
Network Protocols
Network Sockets
Data Serialization and Deserialization
Serializer Benchmarks
DataSet Serialization
Windows Communication Foundation
Throttling
Process Model
Caching
Asynchronous WCF Clients and Servers
Bindings
Summary
Chapter 8: Unsafe Code and Interoperability
Unsafe Code
Pinning and GC Handles
Lifetime Management
Allocating Unmanaged Memory
Memory Pooling
P/Invoke
PInvoke.net and P/Invoke Interop Assistant
Binding
Marshaler Stubs
Blittable Types
Marshaling Direction, Value and Reference Types
Code Access Security
COM Interoperability
Lifetime Management
Apartment Marshaling
TLB Import and Code Access Security
NoPIA
Exceptions
C++/CLI Language Extensions
The marshal_as Helper Library
IL Code vs. Native Code
Windows 8 WinRT Interop
Best Practices for Interop
Summary
Chapter 9: Algorithm Optimization
Taxonomy of Complexity
Big-Oh Notation
Turing Machines and Complexity Classes
Memoization and Dynamic Programming
Edit Distance
All-Pairs-Shortest-Paths
Approximation
Traveling Salesman
Maximum Cut
Probabilistic Algorithms
Probabilistic Maximum Cut
Fermat Primality Test
Indexing and Compression
Variable Length Encoding
Index Compression
Summary
Chapter 10: Performance Patterns
JIT Compiler Optimizations
Standard Optimizations
Method Inlining
Range-Check Elimination
Tail Call
Startup Performance
Pre-JIT Compilation with NGen (Native Image Generator)
Multi-Core Background JIT Compilation
Image Packers
Managed Profile-Guided Optimization (MPGO)
Miscellaneous Tips for Startup Performance
Processor-Specific Optimization
Single Instruction Multiple Data (SIMD)
Instruction-Level Parallelism
Exceptions
Reflection
Code Generation
Generating Code from Source
Generating Code Using Dynamic Lightweight Code Generation
Summary
Chapter 11: Web Application Performance
Testing the Performance of Web Applications
Visual Studio Web Performance Test and Load Test
HTTP Monitoring Tools
Web Analyzing Tools
Improving Web Performance on the Server
Cache Commonly Used Objects
Using Asynchronous Pages, Modules, and Controllers
Tweaking the ASP.NET Environment
Turn Off ASP.NET Tracing and Debugging
Disable View State
Server-Side Output Cache
Pre-Compiling ASP.NET Applications
Fine-Tuning the ASP.NET Process Model
Configuring IIS
Output Caching
Application Pool Configuration
Optimizing the Network
Apply HTTP Caching Headers
Turn on IIS Compression
Minification and Bundling
Use Content Delivery Networks (CDNs)
Scaling ASP.NET Applications
Scaling Out
ASP.NET Scaling Mechanisms
Scaling Out Pitfalls
Summary
Index
← Prev
Back
Next →
← Prev
Back
Next →