Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
R High Performance Programming
R High Performance Programming

R High Performance Programming: Overcome performance difficulties in R with a range of exciting techniques and solutions

Arrow left icon
Profile Icon Aloysius Shao Qin Lim Profile Icon Tjhi W Chandra
Arrow right icon
$13.98 $19.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4 (14 Ratings)
eBook Jan 2015 176 pages 1st Edition
eBook
$13.98 $19.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Aloysius Shao Qin Lim Profile Icon Tjhi W Chandra
Arrow right icon
$13.98 $19.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4 (14 Ratings)
eBook Jan 2015 176 pages 1st Edition
eBook
$13.98 $19.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$13.98 $19.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

R High Performance Programming

Chapter 1. Understanding R's Performance – Why Are R Programs Sometimes Slow?

R is a great tool used for statistical analysis and data processing. When it was first developed in 1993, it was designed as a tool that would teach data analysis courses. Because it is so easy to use, it became more and more popular over the next 20 years, not only in academia, but also in government and industry. R is also an open source tool, so its users can use it for free and contribute new statistical packages to the R public repository called the Comprehensive R Archive Network (CRAN). As the CRAN library became richer with more than 6,000 well-documented and ready-to-use packages at the time of writing this book, the attractiveness of R increased even further. In these 20 years, the volume of data being created, transmitted, stored, and analyzed, by organizations and individuals alike, has also grown exponentially. R programmers who need to process and analyze the ever growing volume of data sometimes find that R's performance suffers under such heavy loads. Why does R sometimes not perform well, and how can we overcome its performance limitations? This book examines the factors behind R's performance and offers a variety of techniques to improve the performance of R programs, for example, optimizing memory usage, performing computations in parallel, or even tapping the computing power of external data processing systems.

Before we can find the solutions to R's performance problems, we need to understand what makes R perform poorly in certain situations. This chapter kicks off our exploration of the high-performance R programming by taking a peek under the hood to understand how R is designed, and how its design can limit the performance of R programs.

We will examine three main constraints faced by any computational task—CPU, RAM, and disk input/output (I/O)—and then look at how these play out specifically in R programs. By the end of this chapter, you will have some insights into the bottlenecks that your R programs could run into.

This chapter covers the following topics:

  • Three constraints on computing performance—CPU, RAM, and disk I/O
  • R is interpreted on the fly
  • R is single-threaded
  • R requires all data to be loaded into memory
  • Algorithm design affects time and space complexity

Three constraints on computing performance – CPU, RAM, and disk I/O

First, let's see how R programs are executed in a computer. This is a very simplified version of what actually happens, but it suffices for us to understand the performance limitations of R. The following figure illustrates the steps required to execute an R program.

Three constraints on computing performance – CPU, RAM, and disk I/O

Steps to execute an R program

Take for example, this simple R program, which loads some data from a CSV file, computes the column sums, and writes the results into another CSV file:

data <- read.csv("mydata.csv")
totals <- colSums(data)
write.csv(totals, "totals.csv")

We use the numbering to understand the preceding diagram:

  1. When we load and run an R program, the R code is first loaded into RAM.
  2. The R interpreter then translates the R code into machine code and loads the machine code into the CPU.
  3. The CPU executes the program.
  4. The program loads the data to be processed from the hard disk into RAM (read.csv() in the example).
  5. The data is loaded in small chunks into the CPU for processing.
  6. The CPU processes the data one chunk at a time, and exchanges chunks of data with RAM until all the data has been processed (in the example, the CPU executes the instructions of the colSums() function to compute the column sums on the data set).
  7. Sometimes, the processed data is stored back onto the hard drive (write.csv() in the example).

From this depiction of the computing process, we can see a few places where performance bottlenecks can occur:

  • The speed and performance of the CPU determines how quickly computing instructions, such as colSums() in the example, are executed. This includes the interpretation of the R code into the machine code and the actual execution of the machine code to process the data.
  • The size of RAM available on the computer limits the amount of data that can be processed at any given time. In this example, if the mydata.csv file contains more data than can be held in the RAM, the call to read.csv() will fail.
  • The speed at which the data can be read from or written to the hard disk (read.csv() and write.csv() in the example), that is, the speed of the disk input/output (I/O) affects how quickly the data can be loaded into the memory and stored back onto the hard disk.

Sometimes, you might encounter these limiting factors one at a time. For example, when a dataset is small enough to be quickly read from the disk and fully stored in the RAM, but the computations performed on it are complex, then only the CPU constraint is encountered. At other times, you might find them occurring together in various combinations. For example, when a dataset is very large, it takes a long time to load it from the disk, only one small chunk of it can be loaded at any given time into the memory, and it takes a long time to perform any computations on it. In either case, these are the symptoms of performance problems. In order to diagnose the problems and find solutions for them, we need to look at what is happening behind the scenes that might be causing these constraints to occur.

Let's now take a look at how R is designed and how it works, and see what the implications are for its performance.

R is interpreted on the fly

In computer science parlance, R is known as an interpreted language. This means that every time you execute an R program, the R interpreter interprets and executes the R code on the fly. The following figure illustrates what happens when you run any R code:

R is interpreted on the fly

Interpreted language versus compiled language

R first parses your source code into an internal R object representation of all the statements and expressions in your R code. R then evaluates this internal R object to execute the code.

This is what makes R such a dynamic and interactive programming language. You can type R statements into the R console and get results immediately because the R interpreter parses and evaluates the code right away. The downside of this approach is that R code runs relatively slow because it is reinterpreted every time you run it, even when it has not changed.

Contrast this with a compiled language such as C or Fortran. When you work with a compiled language, you compile your source code into the machine code before you execute it. This makes compiled languages less interactive because the compilation step can take several minutes for large programs, even when you have made just a tiny change to the code. On the other hand, once the code has been compiled, it runs very quickly on the CPU since it is already in the computer's native language.

Due to R being an interpreted language, every time you run an R program, the CPU is busy doing two things: interpreting your code and executing the instructions contained in it. Therefore, the CPU's speed can limit the performance of R programs. We will learn how to overcome CPU limitations in chapters 3 to 5.

R is single-threaded

Another way in which R is CPU limited is that, by default, it runs only on a single thread on the CPU. It does not matter if you install R on a powerful server with 64 CPU cores, R will only use one of them. For example, finding the sum of a numeric vector is an operation that can be made to run in parallel in the CPU quite easily. If there are four CPU cores available, each core can be given roughly one quarter of the data to process. Each core computes the subtotal of the chunk of data it is given, and the four subtotals are then added up to find the total sum of the whole dataset. However in R, the sum() function runs serially, processing the entire dataset on one CPU core. In fact, many Big Data operations are of a similar nature to the summation example here, with the same task running independently on many subsets of data. In such a scenario, performing the operation sequentially would be an underuse of today's mostly parallel computing architectures. In Chapter 8, Multiplying Performance with Parallel Computing, we will learn how to write parallel programs in R to overcome this limitation.

R requires all data to be loaded into memory

All data that is processed in R has to be fully loaded into the RAM. This means that once the data has been loaded, all of it is available for processing by the CPU, which is great for performance. On the other hand, it also means that the maximum size of data that you can process depends on the amount of free RAM available on your system. Remember that not all the RAM on your computer is available to R. The operating system, background processes, and any other applications that are running in the CPU also compete for the RAM. What is available for R to use might be a fraction of the total RAM installed on the system.

On top of that, R also requires free RAM to store the results of its computations. Depending on what kinds of computations you are performing, you might need the available RAM to be twice or even more times as large as the size of your data.

32-bit versions of R are also limited by the amount of RAM they can access. Depending on the operating system, they might be limited to 2 GB to 4 GB of RAM even when there is actually more RAM available. Furthermore, due to memory address limits, data structures in 32-bit versions of R can contain at most 231-1 = 2,147,483,647 elements. Because of these limits, you should use the 64-bit versions of R whenever you can.

Note

In all versions of R prior to 3.0, even 64-bit versions, vectors and other data structures faced this 2,147,483,647-element limit. If you have data that exceeds this size, you need to use a 64-bit version of R 3.0 or one of its later versions.

What happens when we try to load a dataset that is larger than the available RAM? Sometimes, the data loads successfully, but once the available RAM is used up, the operating system starts to swap the data in RAM into a swapfile on the hard disk. This is not a feature of R; it depends on the operating system. When this happens, R thinks that all the data has been loaded into the RAM when in fact the operating system is hard at work in the background swapping data between RAM and the swapfile on the disk. When such a situation occurs, we have a disk I/O bottleneck on top of the memory bottleneck. Because disk I/O is so slow (hard drive's speed is typically measured in milliseconds, while RAM's speed in nanoseconds), it can cause R to appear as if it is frozen or becomes unresponsive. Of the three performance limitations we looked at, disk I/O often has the largest impact on R's performance.

Chapter 6, Simple Tweaks to Use Less RAM and Chapter 7, Processing Large Datasets with Limited RAM will discuss how to optimize memory usage and work with datasets that are too large to fit into the memory.

Algorithm design affects time and space complexity

There is one other performance factor that we have not discussed—your code. The types of computations and algorithms that you run can have a huge impact on performance. Computer scientists describe the performance characteristics of programs in terms of complexity. In particular, we are concerned about two types of complexities:

  • Time complexity: This refers to the computing time required to run an R program in relation to the size of the data being processed
  • Space complexity: This refers to the memory that is required to run an R program in relation to the size of the data being processed

Let's look at an example of time complexity. Suppose that we need to write a function to compute the nth Fibonacci number, that is, a number in the sequence 0, 1, 1, 2, 3, 5, 8, 13, … where each number is the sum of the previous two numbers. A simple way to do this would be to write a recursive function such as:

fibonacci_rec <- function(n) {
    if (n <= 1) {
        return(n)
    }
    return(fibonacci_rec(n - 1) + fibonacci_rec(n - 2))
}

Since the nth Fibonacci number is the sum of the (n-1)th and (n-2)th Fibonacci numbers, this function simply calls itself to compute the previous two numbers, then adds them up. Let's see how long it takes to compute the 25th Fibonacci number using the microbenchmark() function from the microbenchmark package, which can be downloaded and installed from CRAN (we will take a closer look at how to use this function in Chapter 2, Measuring Code's Performance):

microbenchmark(fibonacci_rec(25), unit = "ms")
## Unit: milliseconds
##               expr      min    lq     mean   median       uq
##  fibonacci_rec(25) 170.1014 179.8 191.4213 183.5275 197.5833
##       max neval
##  253.1433   100

It took a median of 184 milliseconds. Because of the way the recursion works, there is a lot of unnecessary repetition. For example, to compute the 25th Fibonacci number, we need to compute the 23rd and 24th numbers in the sequence. But, computing the 24th number also involves computing the 23rd number, so the 23rd number is computed twice. And the 22nd number is needed to compute both the 23rd and 24th numbers, and so on.

We can reduce this repetition by computing each number only once. The following code presents an alternative implementation of the Fibonacci function that does just that. It computes the Fibonacci numbers in sequence from smallest to largest and remembers the numbers that it has computed in the numeric vector fib. Thus, each Fibonacci number is computed only once:

fibonacci_seq <- function(n) {
    if (n <= 1) {
        return(n)
    }
    # (n+1)th element of this vector is the nth Fibonacci number
    fib <- rep.int(NA_real_, n + 1)
    fib[1] <- 0
    fib[2] <- 1
    for (i in 2:n) {
        fib[i + 1] <- fib[i] + fib[i - 1]
    }
    return(fib[n + 1])
}

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

By benchmarking this sequential function, we see that it takes a median of 0.04 milliseconds to run, a reduction of 99.98 percent from the recursive version!

microbenchmark(fibonacci_seq(25), unit = "ms")
## Unit: milliseconds
##               expr     min       lq      mean    median      uq
##  fibonacci_seq(25) 0.03171 0.036133 0.0446416 0.0405555 0.04459
##                        max neval
##                   0.114714   100

To demonstrate the concept of time complexity, we ran the benchmark for different values of n ranging from 0 to 50. The median execution times are shown in the following figure:

Algorithm design affects time and space complexity

Execution time of recursive versus sequential versions of Fibonacci function

As we increase the value of n, the execution time of the recursive version of the Fibonacci function increases exponentially. It is roughly proportional to 1.6n—every time n increases by 1, it gets multiplied by about 1.6 times. The execution time increased so fast that it took too long to compute the Fibonacci numbers after the 50th one. On the other hand, though it is imperceptible from the chart, the execution time of the sequential version increases linearly—every increase in n increases the execution time by 1.3 microseconds. Since the computational complexity of the sequential version is much lower than that of the recursive version, it will perform much better as n increases. As a case in point, with a modest value of n=50, the sequential version took a fraction of a millisecond to get computed while the recursive version took over eight hours!

Though we will not do it here, a similar exercise can be conducted in order to compare the space complexity of different algorithms. Given a certain amount of computational resources, your choice of algorithm and the design of your code can have a big impact on your R program's ability to achieve the desired level of performance.

Summary

In this chapter, we saw how R programs can sometimes encounter the three constraints faced by computing performance—CPU, RAM, and disk I/O. We looked into R's design and learned how its interpreted and single-threaded nature can cause it to run slowly, and how it can encounter memory and disk I/O limitations when data becomes too big to fit into the RAM. Finally, we looked at how the design of R code plays an important role in determining the performance using a comparison between two implementations of the Fibonacci function with very different performance characteristics.

These performance issues are not insurmountable. The rest of this book will show you different ways to overcome or work around them and unlock the hidden potential of R.

Left arrow icon Right arrow icon

Description

This book is for programmers and developers who want to improve the performance of their R programs by making them run faster with large data sets or who are trying to solve a pesky performance problem.

Who is this book for?

This book is for programmers and developers who want to improve the performance of their R programs by making them run faster with large data sets or who are trying to solve a pesky performance problem.

What you will learn

  • Benchmark and profile R programs to solve performance bottlenecks
  • Understand how CPU, memory, and disk input/output constraints can limit the performance of R programs
  • Optimize R code to run faster and use less memory
  • Use compiled code in R and other languages such as C to speed up computations
  • Harness the power of GPUs for computational speed
  • Process data sets that are larger than memory using diskbased memory and chunking
  • Tap into the capacity of multiple CPUs using parallel computing
  • Leverage the power of advanced database systems and Big Data tools from within R

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 29, 2015
Length: 176 pages
Edition : 1st
Language : English
ISBN-13 : 9781783989270
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 29, 2015
Length: 176 pages
Edition : 1st
Language : English
ISBN-13 : 9781783989270
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 142.97
R High Performance Programming
$32.99
Mastering Scientific Computing with R
$54.99
Mastering Predictive Analytics with R
$54.99
Total $ 142.97 Stars icon
Banner background image

Table of Contents

11 Chapters
1. Understanding R's Performance – Why Are R Programs Sometimes Slow? Chevron down icon Chevron up icon
2. Profiling – Measuring Code's Performance Chevron down icon Chevron up icon
3. Simple Tweaks to Make R Run Faster Chevron down icon Chevron up icon
4. Using Compiled Code for Greater Speed Chevron down icon Chevron up icon
5. Using GPUs to Run R Even Faster Chevron down icon Chevron up icon
6. Simple Tweaks to Use Less RAM Chevron down icon Chevron up icon
7. Processing Large Datasets with Limited RAM Chevron down icon Chevron up icon
8. Multiplying Performance with Parallel Computing Chevron down icon Chevron up icon
9. Offloading Data Processing to Database Systems Chevron down icon Chevron up icon
10. R and Big Data Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(14 Ratings)
5 star 57.1%
4 star 28.6%
3 star 7.1%
2 star 7.1%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




adnan baloch Mar 09, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book deserves to be on the shelf of any serious R user. The author explains the details of R's inner workings so the readers get a good idea about its limitations. Benchmarks are the mainstay of any performance enthusiast. The author dedicates an entire chapter to helping readers understand how to measure the performance of their code so they can quickly find out if they are on the right track when tuning their code for speed. Sometimes the best optimizations are simple ones. Such tweaks get their own chapter in the book. As any programmer knows, compiling is the quickest way to make code fly. Excellent coverage of this aspect is provided by the author. With the proliferation of GPU's in every new PC, serious data scientists now have another weapon in their arsenal. The author shows us how to take the GPU out for a ride and unleash its power. Not all tasks are best suited for GPU's so the author explains how to ensure that the right processing unit is used for the right job. Getting the best out of R by making the most of available RAM, supercharging R with parallel computation, using databases to assist in processing tasks and stepping into the world of Big Data are also explored by the author and promise to take the reader's R expertise to a whole new level.
Amazon Verified review Amazon
Arda Apr 13, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great book covering almost all approaches you may want to take when you need to squeeze some more performance out of your existing R code. It covers almost all aspects of optimization, from reducing time complexity of your applications (ie, profiling, identifying bottlenecks, using compiled code for bottlenecks, using GPUs etc) to reducing space complexity (memory optimization, tweaks for working with resource restrained systems) to horizontal scaling. The last step (RHadoop) can be a good stepping stone if all else fails and you need to use a distributed solution.
Amazon Verified review Amazon
ruben Apr 11, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Hello very interesting book important topics that programmers do not gave follow in the R programming procedures.I like all the chapters because it explain the basics so we can go on doing and applying the main concepts.In my opinion the kind of topics rarely don't cover in a regular class so for me that I used this informstion it was a nice experience to teach this kind of information very helpful.Thanks.
Amazon Verified review Amazon
Massera Riccardo Mar 04, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
R High Performance Programming is an excellent book to help R programmers to take advantage of all the features of the language and solve practical performance problems or bottlenecks that they might encounter processing large amounts of data.Every chapter explains a topic with simple but meaningful examples,showing which tools to use and how to pick the right packages from CRAN.The reader is also given the choice to only read certain chapters if he does not want to delve into the more advanced topics.The book starts by introducing the reader to R features, the language internals and its memory model.The authors then explain how to correctly measure code performance and the basic tricks that can be adopted when coding an R program to ensure code runs fast and does not waste computing resources.After this introductory part, the book deals with a set of advanced techniques to get your programs running even faster, like developing code compiled for R, accelerating the computation by taking advantage of the GPU, optimizing the memory footprint and processing large datasets with limited resources.For scenarios where the previous techniques are not sufficient, the last chapters deal with parallelization or R programs, offloading the processing to a database and dealing with Big Data with an example running on AWS.In conclusion, I really enjoyed reading this book because it is written in a very simple and understandable manner also for less experienced programmers and even complex subjects are explained in a simple way.
Amazon Verified review Amazon
A. Zubarev Feb 22, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
R High Performance Programming is probably a unique book in terms of the material covered, I just have not see yet to date a book that is dedicated to increasing the computational capacity of the R language.And I need to state frankly, since R has left the academic circles a long time ago and now is being used more and more in applications involving the Big Data calibre of projects a developer or an R user needs to understand its limitations and perhaps even be able to shrug off some misconceptions that surface on and off about the R’s Big Data suitability.This book will make you prepared to cope with those who encroach on R’s capability to process petabytes of data. Bedsides, since the authors have a very broad outlook on the technologies and succeeded to cover very difficult topics in simple terms this book actually is of an asset to any software developer, using any language on any platformWhat do you need for this book: preferably a *NIX based 64 bit machine capable enough to run a Virtual Machine with an NVIDIA GPU. An Amazon EWS account. Eclipse R Add on (R Studio was cited as storing object state). A Windows user will be able to learn as much, but some of the libraries covered in the book (just a few) were not ported to Windows at the time of my reading.Aloysius and William cover the code execution benchmarking techniques at the beginning very well and then make you embark on wonderful journey to exploring an array of CRAN packages, third party tools and frameworks, the book includes the use of Hadoop, PostgreSQL, MonetDB (vertical data store), Pivotal SciDB, and more so you will not be limited to a narrow subset of tools to use under your belt, it will be something like dirking from the firehose!I read this book in one breath, it is was just that a fascinating journey. I now think I need to come back, and read several chapters of immense interest to me: code pre-compilation (just so easy to take advantage of), the FF, dplyr and BigMemory package (just take advantage of somebody giving you a hand). I will experiment with at least one database, perhaps MonetDB as being at fingertips reach.If I had a small complaint that would be for the absence of the statistical visualizations code – I just would like to benchmark my own improvements.All in all, it is a fantastic book, thank you Aloysius and William! A very timely release Packt!My verdict, is it a superb reading!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.