万本电子书0元读

万本电子书0元读

顶部广告

Scala High Performance Programming电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Vincent Theron, Michael Diamant

出  版  社:Packt Publishing

出版时间:2016-05-31

字       数:405.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Leverage Scala and the functional paradigm to build performant softwareAbout This Book·Get the first book to explore Scala performance techniques in depth!·Real-world inspired use cases illustrate and support the techniques studied and the language features·This book is written by Vincent Theron and Michael Diamant, software engineers with several years of experience in the high-frequency trading and programmatic advertising industriesWho This Book Is ForThis book assumes a basic exposure to the Scala programming language and the Java Virtual Machine. You should be able to read and understand moderately advanced Scala code. No other knowledge is required.What You Will Learn·Analyze the performance of JVM applications by developing JMH benchmarks and profiling with Flight Recorder·Discover use cases and performance tradeoffs of Scala language features, and eager and lazy collections·Explore event sourcing to improve performance while working with stream processing pipelines·Dive into asynchronous programming to extract performance on multicore systems using Scala Future and Scalaz Task·Design distributed systems with conflict-free replicated data types (CRDTs) to take advantage of eventual consistency without synchronization·Understand the impact of queues on system performance and apply the Free monad to build systems robust to high levels of throughputIn DetailScala is a statically and strongly typed language that blends functional and object-oriented paradigms. It has experienced growing popularity as an appealing and pragmatic choice to write production-ready software in the functional paradigm. Scala and the functional programming paradigm enable you to solve problems with less code and lower maintenance costs than the alternatives. However, these gains can come at the cost of performance if you are not careful.Scala High Performance Programming arms you with the knowledge you need to create performant Scala applications. Starting with the basics of understanding how to define performance, we explore Scala's language features and functional programming techniques while keeping a close eye on performance throughout all the topics.We introduce you as the newest software engineer at a fictitious financial trading company, named MV Trading. As you learn new techniques and approaches to reduce latency and improve throughput, you'll apply them to MV Trading's business problems. By the end of the book, you will be well prepared to write production-ready, performant Scala software using the functional paradigm to solve real-world problems.Style and approachThis step-by-step guide will help you create high performance applications using Scala. Packed with lots of code samples, tips and tricks, every topic is explained in a detailed, easy-to-understand manner.
目录展开

Scala High Performance Programming

Scala High Performance Programming

Credits

About the Authors

About the Reviewer

www.PacktPub.com

eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. The Road to Performance

Defining performance

Performant software

Hardware resources

Latency and throughput

Bottlenecks

Summarizing performance

The problem with averages

Percentiles to the rescue

Collecting measurements

Using benchmarks to measure performance

Profiling to locate bottlenecks

Pairing benchmarks and profiling

A case study

Tooling

Summary

2. Measuring Performance on the JVM

A peek into the financial domain

Unexpected volatility crushes profits

Reproducing the problem

Throughput benchmark

Latency benchmark

The first latency benchmark

The coordinated omission problem

The second latency benchmark

The final latency benchmark

Locating bottlenecks

Did I test with the expected set of resources?

Was the system environment clean during the profiling?

Are the JVM's internal resources performing to expectations?

Where are the CPU bottlenecks?

What are the memory allocation patterns?

Trying to save the day

A word of caution

A profiling checklist

Taking big steps with microbenchmarks

Microbenchmarking the order book

Summary

3. Unleashing Scala Performance

Value classes

Bytecode representation

Performance considerations

Tagged types - an alternative to value classes

Specialization

Bytecode representation

Performance considerations

Tuples

Bytecode representation

Performance considerations

Pattern matching

Bytecode representation

Performance considerations

Tail recursion

Bytecode representation

Performance considerations

The Option data type

Bytecode representation

Performance considerations

Case study – a more performant option

Summary

4. Exploring the Collection API

High-throughput systems – improving the order book

Understanding historical trade-offs – list implementation

List

TreeMap

Adding limit orders

Canceling orders

The current order book – queue implementation

Queue

Improved cancellation performance through lazy evaluation

Set

Benchmarking LazyCancelOrderBook

Lessons learned

Historical data analysis

Lagged time series returns

Vector

Data clean up

Handling multiple return series

Array

Looping with the Spire cfor macro

Summary

5. Lazy Collections and Event Sourcing

Improving the client report generation speed

Diving into the reporting code

Using views to speed up report generation time

Constructing a custom view

Applying views to improve report generation performance

View caveats

SeqView extends Seq

Views are not memoizers

Zipping up report generation

Rethinking reporting architecture

An overview of Stream

Transforming events

Building the event sourcing pipeline

Streaming Markov chains

Stream caveats

Streams are memoizers

Stream can be infinite

Summary

6. Concurrency in Scala

Parallelizing backtesting strategies

Exploring Future

Future and crazy ideas

Future usage considerations

Performing side-effects

Blocking execution

Handling failures

Hampering performance through executor submissions

Handling blocking calls and callbacks

ExecutionContext and blocking calls

Asynchronous versus nonblocking

Using a dedicated ExecutionContext to block calls

Using the blocking construct

Translating callbacks with Promise

From callbacks to a Future-based API

Combining Future with Promise

Tasked with more backtest performance improvements

Introducing Scalaz Task

Creating and executing Task

Asynchronous behavior

The execution model

Modeling trading day simulations with Task

Wrapping up the backtester

Summary

7. Architecting for Performance

Distributed automated traders

A glimpse into distributed architectures

The first attempt at a distributed automated trader

Introducing CRDTs

The state-based increase-only counter

The operation-based increase-only counter

CRDTs and automated traders

When the balance is not enough

A new CRDT - the grow-only set

Free trading strategy performance improvements

Benchmarking the trading strategy

The danger of unbounded queues

Applying back pressure

Applying load-control policies

Rejecting work

Interrupting expensive processing

Free monads

Describing a program

Building an interpreter

Benchmarking the new trading strategy pipeline

A Task interpreter

Exploring free monads further

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部