Compile-Time vs Runtime Reflection

The cluster centers on debates about whether language features like reflection, code generation, and optimizations occur at compile time (avoiding runtime costs) or runtime, referencing languages such as Python, Zig, Java, and others.

➡️ Stable 0.7x Programming Languages
3,443
Comments
19
Years Active
5
Top Authors
#3236
Topic ID

Activity Over Time

2008
5
2009
25
2010
55
2011
54
2012
68
2013
82
2014
145
2015
184
2016
188
2017
258
2018
211
2019
213
2020
315
2021
278
2022
315
2023
339
2024
276
2025
407
2026
25

Keywords

CS PHP JVM JIT AOT IL PC github.com CSharpSerializerTests.cs CL compile time compile runtime compilation compiler reflection compiled code phase jit

Sample Comments

sinhpham Jan 18, 2017 View on HN

It's being done at compile time.

SpaghettiCthulu Apr 16, 2023 View on HN

It's not actually done at compile time. See my reply to messe for details.

afdbcreid Jan 5, 2025 View on HN

We're talking about compile-time reflection here, not runtime reflection.

c3833174 Mar 1, 2018 View on HN

Compile time doesn't mean the compiler won't add more instructions where you might not expect them.

Keyframe Sep 18, 2015 View on HN

Indeed, albeit at compile time and not run time.

tantalor Jul 7, 2016 View on HN

Any reason why they are compiled at runtime and not compile time? That might be preferable for large programs.

phpnode Apr 15, 2025 View on HN

You’re talking about runtime, I’m talking about at compile time

pantalaimon Feb 6, 2017 View on HN

I don't see an obvious reason - that's all information that's available on compile-time, there should be no additional run-time cost - or what are you implying?

pjmlp Aug 3, 2023 View on HN

Compile time reflection doesn't have runtime cost.

danbmil99 Apr 27, 2009 View on HN

heh, I thought you meant compile time.