Code compilation
Code compilation is the translation of source code or another formal representation into an executable, intermediate, or lower-level representation.
Deep Learning with R, Third Edition
PyTorch compilation is the transformation of PyTorch computations into an optimized executable representation.
- How it is used
- Uses compilation as an optional way to speed up PyTorch functions or Modules while contrasting it with eager execution.
- How deep it goes
- Shows the compilation calls and explains expected behavior and limitations, but does not detail compiler internals.
- Examples
- Compiles a linear-classifier Module and a dense function using `torch$compile()`.
- What you can do after
- Apply it via `torch$compile()` to a function or Module, then check whether it works and improves performance.
Read how Deep Learning with R, Third Edition explains code compilation →
LLMs in Production
Compilation is the transformation of high-level program or model code into lower-level code optimized for execution on target hardware.
- How it is used
- Uses compilation to adapt model inference to target hardware and improve production efficiency.
- How deep it goes
- Explains the framework-to-intermediate-representation-to-machine-code pipeline and demonstrates TensorRT configuration.
- Examples
- Uses GPT-2 TensorRT tracing, ONNX export commands, llama.cpp, and graph-optimized fused kernels.
- What you can do after
- Apply it via TensorRT or ONNX export tooling to produce hardware-oriented model artifacts.
Deep Learning with JAX
The process of converting code into optimized executable form.
- How it is used
- Speeds up massive computations and smaller latency-sensitive tasks through JAX JIT compilation.
- How deep it goes
- Explains Python-to-Jaxpr conversion, typed primitives, tracing constraints, static arguments, and structured control flow before XLA.
- Examples
- Demonstrates SELU, array reduction, loops, conditionals, side effects, tracer errors, and `jax.make_jaxpr()` output.
- What you can do after
- Diagnose tracing failures, inspect Jaxpr, and apply `jax.jit` with static arguments or control-flow primitives.
Modern Angular
Compilation is the process of translating source code or templates into executable code or an intermediate representation.
- How it is used
- Explains how Angular turns declarative templates into browser-executable rendering commands for development, production, and SSR.
- How deep it goes
- Distinguishes JIT and AOT workflows and their performance tradeoff, but defers the compiler’s generated command details.
- Examples
- Uses ng serve for JIT development, ng build for AOT production, and a standalone component template as the compilation input.
- What you can do after
- Evaluate/understand Angular build choices and recognize why precompilation improves production runtime behavior.
Deep Learning with Python, Third Edition
The process of converting code into a compiled form for execution, used here as a performance and debugging tradeoff in TensorFlow, JAX, and PyTorch.
- How it is used
- Uses just-in-time compilation to make TensorFlow functions fast.
- How deep it goes
- Demonstrates compilation through decorators but stops short of explaining compilation internals or a debugging workflow.
- Examples
- Uses a dense function decorated with @tf.function and @tf.function(jit_compile=True).
- What you can do after
- Apply it via TensorFlow decorators to request compiled execution for a numerical function.
Read how Deep Learning with Python, Third Edition explains code compilation →
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
Model compilation is the transformation of a trained model into lower-level executable code for faster inference or deployment.
- How it is used
- Accelerates prediction and simplifies deployment for tree-based models by producing lower-level executable implementations.
- How deep it goes
- Demonstrates model export, conversion, code generation, library creation, preprocessing, and prediction, without detailing generated machine code internals.
- Examples
- Uses Treelite with XGBoost and lleaves with LightGBM to compile saved tree models for prediction.
- What you can do after
- Apply it via Treelite, tl2cgen, or lleaves to generate compiled predictors from trained tree models.
Secrets of the JavaScript Ninja, Second Edition
The process of translating a program or expression into an internal form suitable for execution.
- How it is used
- Uses precompilation to reduce repeated regular-expression setup when patterns are reused.
- How deep it goes
- Explains parsing and conversion into an internal representation, but leaves that representation unspecified.
- Examples
- Compares literal and constructor creation, including case-insensitive matching and distinct object identity.
- What you can do after
- Apply precompilation with JavaScript regex literals or RegExp constructors to reuse patterns.
Read how Secrets of the JavaScript Ninja, Second Edition explains code compilation →
Related concepts
- Treeliteproduced by · Treelite is a tool that compiles decision-tree ensemble models into portable low-dependency C or Java code.
- compilation testmeasured by · A compilation test checks whether source code, including a macro invocation, compiles successfully or fails as expected.
- Dockerused by · Docker is a platform and ecosystem for building, distributing, and running applications in containers.
- just-in-time compilationincludes · Just-in-time compilation translates or optimizes program code during execution, often using runtime information to generate specialized executable instructions.
- mix environmentconfigured by · A Mix environment is a project configuration context, such as development, test, or production, that determines the compilation target and related build settings.
- generationused by · Generation is the computational production of outputs from supplied inputs or context, often by applying a model to produce predictions or new content.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.






