O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

TypeScript High Performance

Book Description

Get lightning speed performance by writing highly efficient code in TypeScript

About This Book

  • Efficiently use Data Structures, Language Constructs, & Handle Asynchrony
  • Monitor the performance, Code Quality, & Resource Optimizations
  • Build & Deploy Strategies for Large Scale TypeScript Projects

Who This Book Is For

This book is for people who have basic knowledge of TypeScript. Experience using JavaScript and familiarity with front end development are the prerequisites.

What You Will Learn

  • Learn about the critical rendering path, and the performance metrics involved along the same
  • Explore the detailed inner intricacies of a web browser
  • Build a large scale front end applications and learn the thought process behind architecting such an effort
  • Understand the challenges of scalability and how TypeScript renders itself to the cause
  • Learn efficient usage of TypeScript constructs to deliver high performance and avoid common mistakes and pitfalls that can hamper performance
  • Monitor performance, resolve and detect performance bottlenecks in production, and learn the tools involved

In Detail

In a world where a tiny decrease in frames per second impacts customer engagement greatly, writing highly scalable code is more of a necessity than a luxury. Using TypeScript you get type checking during development. This gives you the power to write optimized code quickly. This book is also a solid tool to those who’re curious to understand the impact of performance in production, and it is of the greatest aid to the proactive developers who like to be cognizant of and avoid the classic pitfalls while coding.

The book will starts with explaining the efficient implementation of basic data Structures, data types, and flow control. You will then learn efficient use of advanced language constructs and asynchronous programming. Further, you'll learn different configurations available with TSLint to improve code quality and performance. Next, we'll introduce you to the concepts of profiling and then we deep dive into profiling JS with several tools such as firebug, chrome, fiddler. Finally, you'll learn techniques to build and deploy real world large scale TypeScript applications.

Style and approach

This book will be a step by step easy to follow guide with focused examples to increase performance of applications and provide optimization techniques.

Downloading the example code for this book. 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 code file.

Table of Contents

  1. Preface
    1. What this book covers
      1. Part I – Efficient usage of data structures, language constructs, and handling asynchrony
      2. Part II – Performance monitoring, code quality, and resource optimizations
      3. Part III – Building and deploying strategies for large-scale TypeScript projects
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Errata
      3. Piracy
      4. Questions
  2. Efficient Implementation of Basic Data Structures and Algorithms
    1. Strings
      1. String concatenation
      2. String replacement
    2. Classes and interfaces
    3. Loops and conditions
    4. Arrays and sorting
    5. Operators
    6. Summary
  3. Variable Declarations, Namespaces, and Modules
    1. Variable declarations
      1. The var declarations
      2. The let declarations
      3. The const declarations
      4. Namespaces and modules
      5. Modules
    2. Summary
  4. Efficient Usage of Advanced Language Constructs
    1. Arrow functions
    2. Mixins
    3. Declaration merging
    4. Triple-slash directives
      1. Answers to declaration merging questions
    5. Summary
  5. Asynchronous Programming and Responsive UI
    1. Fundamentals of asynchronous programming and event loop
      1. Synchronous data fetch 
      2. Asynchronous data fetch  
    2. Event loop
    3. Callbacks
      1. Callback Hell
      2. Promises
    4. Async and await
    5. Summary
  6. Writing Quality Code
    1. Unit tests
    2. Static code analysis with TSLint
      1. Setting up TSLint for your project
        1. Editing default rules
        2. Extending TSLint rules
        3. TSLint VSCode Extension
    3. Summary
  7. Efficient Resource Loading - Critical Rendering Path
    1. Resource delivery across the internet
    2. Optimizing the critical rendering path
      1. Optimization 1 - render blocking CSS
      2. Optimization 2 - render blocking JS
    3. Non-blocking UI
      1. Massive data downloads
      2. Massive data uploads
    4. Summary
  8. Profile Deployed JS with Developer Tools and Fiddler
    1. Chrome Developer Tools
      1. Memory profiling
      2. Latency and computation time profiling
      3. The Network tab
    2. Fiddler
    3. Summary
  9. Build and Deployment Strategies for Large-Scale Projects
    1. Building locally
      1. Grunt
      2. Gulp
      3. MSBuild
    2. Continuous integration (CI)
      1. The process
      2. Jenkins
      3. Bamboo
    3. Continuous delivery (CD)
      1. Chef
      2. Puppet
    4. Containerization
      1. Docker
      2. Serverless applications
    5. Testing
    6. Summary