liveBook · Manning

Reflection

As explained in Fast by Default

Reflection is a language or runtime capability that discovers or accesses program types and members dynamically rather than through direct references.

Reflection lets code discover and call program elements at runtime instead of using direct references. Because the compiler cannot determine which parts are needed, reflection can force unused code to remain in the build. section 8.2.2

Treat reflection as a dependency-size risk during build analysis. Inspect large packages and trace their shortest dependency paths before replacing or removing libraries; in Go, use binary analysis to identify reflection-heavy packages. section 8.2.2

Go binary investigation

After stripping symbols and debugging information from a production Go binary, use a size analyzer to locate remaining large packages. Investigate reflection-heavy libraries because their runtime discovery can prevent the compiler from removing unused code. section 8.2.2

How Fast by Default covers it

How deep it goes
Explains runtime discovery and its compiler-size consequence, but stops short of implementation mechanics or reflection APIs.
Examples
Uses Go binary analysis and large-package inspection to expose reflection-related size retention.
What you can do after
Diagnose oversized dependencies by locating reflection-heavy packages and tracing their paths into the application.
How it connects
Connects reflection to dependency analysis, compiler reachability, package dependencies, and binary size.

Also explained in

Compare how 14 books explain reflection →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.