H
HN HRCB new | past | comments | ask | show | jobs | articles | domains | dashboard | seldon | network | factions | velocity | about hrcb
home / david.alvarezrosa.com / item 47155811
+0.14 Devirtualization and Static Polymorphism (david.alvarezrosa.com)
31 points by dalvrosa 5 hours ago | 11 comments on HN | Mild positive Editorial · v3.7 · 2026-02-26
Summary Digital Education & Knowledge Sharing Acknowledges
This is a technical blog post on C++ compiler optimization (devirtualization and static polymorphism), published openly without paywalls. The content engages minimally with human rights, but supports Article 19 (free expression), Article 26 (education), and Article 27 (scientific progress) through its open publication model and contribution to technical knowledge commons. The site demonstrates accessibility-conscious design that supports broader educational access.
Article Heatmap
Preamble: ND — Preamble Preamble: No Data — Preamble P Article 1: ND — Freedom, Equality, Brotherhood Article 1: No Data — Freedom, Equality, Brotherhood 1 Article 2: ND — Non-Discrimination Article 2: No Data — Non-Discrimination 2 Article 3: ND — Life, Liberty, Security Article 3: No Data — Life, Liberty, Security 3 Article 4: ND — No Slavery Article 4: No Data — No Slavery 4 Article 5: ND — No Torture Article 5: No Data — No Torture 5 Article 6: ND — Legal Personhood Article 6: No Data — Legal Personhood 6 Article 7: ND — Equality Before Law Article 7: No Data — Equality Before Law 7 Article 8: ND — Right to Remedy Article 8: No Data — Right to Remedy 8 Article 9: ND — No Arbitrary Detention Article 9: No Data — No Arbitrary Detention 9 Article 10: ND — Fair Hearing Article 10: No Data — Fair Hearing 10 Article 11: ND — Presumption of Innocence Article 11: No Data — Presumption of Innocence 11 Article 12: ND — Privacy Article 12: No Data — Privacy 12 Article 13: ND — Freedom of Movement Article 13: No Data — Freedom of Movement 13 Article 14: ND — Asylum Article 14: No Data — Asylum 14 Article 15: ND — Nationality Article 15: No Data — Nationality 15 Article 16: ND — Marriage & Family Article 16: No Data — Marriage & Family 16 Article 17: ND — Property Article 17: No Data — Property 17 Article 18: ND — Freedom of Thought Article 18: No Data — Freedom of Thought 18 Article 19: +0.17 — Freedom of Expression 19 Article 20: ND — Assembly & Association Article 20: No Data — Assembly & Association 20 Article 21: ND — Political Participation Article 21: No Data — Political Participation 21 Article 22: ND — Social Security Article 22: No Data — Social Security 22 Article 23: ND — Work & Equal Pay Article 23: No Data — Work & Equal Pay 23 Article 24: ND — Rest & Leisure Article 24: No Data — Rest & Leisure 24 Article 25: ND — Standard of Living Article 25: No Data — Standard of Living 25 Article 26: +0.12 — Education 26 Article 27: +0.14 — Cultural Participation 27 Article 28: ND — Social & International Order Article 28: No Data — Social & International Order 28 Article 29: ND — Duties to Community Article 29: No Data — Duties to Community 29 Article 30: ND — No Destruction of Rights Article 30: No Data — No Destruction of Rights 30
Negative Neutral Positive No Data
Aggregates
Weighted Mean +0.14 Unweighted Mean +0.14
Max +0.17 Article 19 Min +0.12 Article 26
Signal 3 No Data 28
Confidence 6% Volatility 0.02 (Low)
Negative 0 Channels E: 0.6 S: 0.4
SETL -0.05 Structural-dominant
FW Ratio 60% 9 facts · 6 inferences
Evidence: High: 0 Medium: 3 Low: 0 No Data: 28
Theme Radar
Foundation Security Legal Privacy & Movement Personal Expression Economic & Social Cultural Order & Duties Foundation: 0.00 (0 articles) Security: 0.00 (0 articles) Legal: 0.00 (0 articles) Privacy & Movement: 0.00 (0 articles) Personal: 0.00 (0 articles) Expression: 0.17 (1 articles) Economic & Social: 0.00 (0 articles) Cultural: 0.13 (2 articles) Order & Duties: 0.00 (0 articles)
HN Discussion 4 top-level · 7 replies
pjmlp 2026-02-25 21:21 UTC link
Nice overview, it misses other kinds of dispatch though.

With concepts, templates and compile time execution, there is no need for CRTP, and in addition it can cover for better error messages regarding what methods to dispatch to.

hinkley 2026-02-25 21:44 UTC link
I wonder if I still have the link.

One of the papers I had bookmarked when toying with my own language design was someone that had worked out how to make interfaces as fast or faster than vtables by using perfect hashing and using the vtable as a hash table instead of a list.

You can also, when inlining a polymorphic call, put a conditional block in that bounces back to full dispatch if the call occasionally doesn’t match the common case. The problem with polymorphic inlining though is that it quickly resembles the exact sort of code we delete and replace with polymorphic dispatch:

    if (typeof arg1 == “string”) {
    } else if typeof arg1 === …) {
    } else if {
    } else if {
    } else {
    }
TimorousBestie 2026-02-25 22:08 UTC link
Good article, rare to see simple explanations of intricate C++ ideas.
gignico 2026-02-25 22:10 UTC link
> Under the hood, a virtual table (vtable) is created for each class, and a pointer (vptr) to the vtable is added to each instance.

Coming from C++ I assumed this was the only way but Rust has an interesting approach where the single objects do not pay any cost because virtual dispatch is handled by fat pointers. So you carry around the `vptr` in fat pointers (`&dyn MyTrait`) only when needed, not in every instance.

dalvrosa 2026-02-25 21:47 UTC link
Fair. New C++ standards are providing great tools for compile-time everything

But still CRTP is widely used in low-latency environments :)

dalvrosa 2026-02-25 21:50 UTC link
Nice one, TIL

One caveat with "hash vtables" is that you only really see a performance win when the interface has a lot of specializations.

anitil 2026-02-25 22:10 UTC link
I've been thinking through what features I'd want in a language if I were designing one myself, and one of my desires is to have exhaustive matches on enums (which could be made of any primitive type) and sum types. The ability to generate perfect hashes at compile time was one of the things that falls out nicely from that
dalvrosa 2026-02-25 22:16 UTC link
Thank you :)
dalvrosa 2026-02-25 22:18 UTC link
Good point, thanks for sharing!
akoboldfrying 2026-02-25 23:13 UTC link
> using the vtable as a hash table instead of a list.

Could you explain this a bit more? The word "list" makes me think you might be thinking that virtual method lookup iterates over each element of the vtable, doing comparisons until it finds a match -- but I'm certain that this is not how virtual method invocation works in C++. The vtable is constructed at compile time and is already the simplest possible "perfect hashtable": a short, dense array with each virtual method mapping to a function pointer at a statically known index.

cataphract 2026-02-25 23:26 UTC link
There have been type-erasure libraries in c++ for a longish time that allow choosing inline vtables and inline storage. It's definitely been a widely talked about technique for at least 10 years (I see talks about Dyno from 2017).
Editorial Channel
What the content says
+0.08
Article 26 Education
Medium Practice
Editorial
+0.08
SETL
+0.05

Article protects education and human development. Content provides technical knowledge that contributes to education and skill development in computer programming and software engineering.

+0.05
Article 19 Freedom of Expression
Medium Coverage
Editorial
+0.05
SETL
-0.12

Article protects freedom of opinion and expression. Content is a technical blog post presenting programming knowledge without editorial restrictions, censorship, or editorial control visible.

+0.03
Article 27 Cultural Participation
Medium Coverage
Editorial
+0.03
SETL
-0.08

Article protects participation in cultural and scientific progress. Content is a technical article contributing to scientific and technical knowledge commons in computer science.

ND
Preamble Preamble

Content is a technical article about C++ programming; no engagement with UDHR preamble concepts (dignity, freedom, justice, peace).

ND
Article 1 Freedom, Equality, Brotherhood

Article concerns equal rights and dignity; content is technical C++ documentation with no engagement with equality or human dignity themes.

ND
Article 2 Non-Discrimination

Article addresses non-discrimination; content contains no discussion of discrimination, protected characteristics, or equality.

ND
Article 3 Life, Liberty, Security

Article protects life, liberty, security of person; content is purely technical with no engagement with safety, security, or personal liberty.

ND
Article 4 No Slavery

Article prohibits slavery; content is unrelated to slavery or servitude.

ND
Article 5 No Torture

Article prohibits torture and cruel treatment; content is technical documentation with no engagement with harm, abuse, or cruelty.

ND
Article 6 Legal Personhood

Article protects legal personhood; content is unrelated to legal status or recognition.

ND
Article 7 Equality Before Law

Article guarantees equal protection under law; content is technical documentation with no engagement with legal protection or equality.

ND
Article 8 Right to Remedy

Article protects remedy for rights violations; content is unrelated to legal remedies or justice.

ND
Article 9 No Arbitrary Detention

Article prohibits arbitrary arrest and detention; content is technical documentation unrelated to arrest, detention, or state power.

ND
Article 10 Fair Hearing

Article protects fair trial and due process; content is technical documentation unrelated to legal proceedings or justice.

ND
Article 11 Presumption of Innocence

Article protects presumption of innocence; content is unrelated to criminal law or presumptions of guilt.

ND
Article 12 Privacy

Article protects privacy; content is technical documentation with no discussion of personal privacy, correspondence, or family.

ND
Article 13 Freedom of Movement

Article protects freedom of movement; content is unrelated to movement, migration, or territorial access.

ND
Article 14 Asylum

Article protects asylum and refuge; content is unrelated to asylum, persecution, or refuge.

ND
Article 15 Nationality

Article protects nationality rights; content is unrelated to nationality or citizenship.

ND
Article 16 Marriage & Family

Article protects marriage and family rights; content is unrelated to marriage, family, or domestic matters.

ND
Article 17 Property

Article protects property rights; content is technical documentation unrelated to property ownership or dispossession.

ND
Article 18 Freedom of Thought

Article protects freedom of conscience, thought, and religion; content is technical documentation with no engagement with belief systems or conscience.

ND
Article 20 Assembly & Association

Article protects freedom of assembly and association; content is unrelated to gathering, association, or collective action.

ND
Article 21 Political Participation

Article protects political participation and voting; content is unrelated to politics, voting, or democratic processes.

ND
Article 22 Social Security

Article protects social security and welfare; content is technical documentation unrelated to social protection or welfare provision.

ND
Article 23 Work & Equal Pay

Article protects work, employment, and fair labor conditions; content is technical documentation, not labor-related.

ND
Article 24 Rest & Leisure

Article protects rest and leisure; content is unrelated to working hours, vacation, or rest.

ND
Article 25 Standard of Living

Article protects adequate standard of living, including food, clothing, housing, and healthcare; content is unrelated to material welfare or health.

ND
Article 28 Social & International Order

Article establishes social and international order for rights realization; content is unrelated to order, governance, or institutional frameworks.

ND
Article 29 Duties to Community

Article establishes duties to community; content is technical documentation with no engagement with community responsibilities or duty frameworks.

ND
Article 30 No Destruction of Rights

Article prevents destruction of rights; content is unrelated to safeguards against rights violations.

Structural Channel
What the site does
Domain Context Profile
Element Modifier Affects Note
Privacy
No privacy policy or data collection statements observable in provided content.
Terms of Service
No terms of service visible in provided content.
Accessibility +0.05
Article 26
Font-face declarations suggest attention to typography and readability; responsive design elements observable (max-width constraints, fluid margins).
Mission
Personal blog/portfolio; no explicit mission statement evident in provided content.
Editorial Code
No editorial standards or code of conduct stated.
Ownership
Personal domain; single author implied by structure.
Access Model +0.08
Article 19 Article 27
Content appears freely accessible without subscription or paywall; open publication model supports information dissemination.
Ad/Tracking
No advertising or tracking pixels observable in provided content.
+0.15
Article 19 Freedom of Expression
Medium Coverage
Structural
+0.15
Context Modifier
+0.08
SETL
-0.12

Content is published freely without paywalls or access restrictions; open publication model supports information dissemination. Domain DCP indicates free access model with +0.08 modifier.

+0.10
Article 27 Cultural Participation
Medium Coverage
Structural
+0.10
Context Modifier
+0.08
SETL
-0.08

Free, open publication model allows broad participation in and benefit from technical knowledge advancement. DCP +0.08 modifier for access model supports this.

+0.05
Article 26 Education
Medium Practice
Structural
+0.05
Context Modifier
+0.05
SETL
+0.05

Site demonstrates accessibility design (responsive layout, typography optimization); DCP modifier of +0.05 for accessibility features supports educational access.

ND
Preamble Preamble

No structural mechanisms observable that relate to preamble themes.

ND
Article 1 Freedom, Equality, Brotherhood

No discriminatory or inclusive structural design signals.

ND
Article 2 Non-Discrimination

No observable structural discrimination or inclusion mechanisms.

ND
Article 3 Life, Liberty, Security

No relevant structural signals.

ND
Article 4 No Slavery

No relevant signals.

ND
Article 5 No Torture

No relevant signals.

ND
Article 6 Legal Personhood

No relevant signals.

ND
Article 7 Equality Before Law

No relevant signals.

ND
Article 8 Right to Remedy

No relevant signals.

ND
Article 9 No Arbitrary Detention

No relevant signals.

ND
Article 10 Fair Hearing

No relevant signals.

ND
Article 11 Presumption of Innocence

No relevant signals.

ND
Article 12 Privacy

No privacy-invasive or privacy-protective mechanisms observable.

ND
Article 13 Freedom of Movement

No relevant signals.

ND
Article 14 Asylum

No relevant signals.

ND
Article 15 Nationality

No relevant signals.

ND
Article 16 Marriage & Family

No relevant signals.

ND
Article 17 Property

No relevant signals.

ND
Article 18 Freedom of Thought

No relevant signals.

ND
Article 20 Assembly & Association

No relevant signals.

ND
Article 21 Political Participation

No relevant signals.

ND
Article 22 Social Security

No relevant signals.

ND
Article 23 Work & Equal Pay

No relevant signals.

ND
Article 24 Rest & Leisure

No relevant signals.

ND
Article 25 Standard of Living

No relevant signals.

ND
Article 28 Social & International Order

No relevant signals.

ND
Article 29 Duties to Community

No relevant signals.

ND
Article 30 No Destruction of Rights

No relevant signals.

Supplementary Signals
Epistemic Quality
0.55 medium claims
Sources
0.5
Evidence
0.6
Uncertainty
0.4
Purpose
0.7
Propaganda Flags
0 techniques detected
Solution Orientation
0.68 solution oriented
Reader Agency
0.7
Emotional Tone
measured
Valence
+0.1
Arousal
0.2
Dominance
0.4
Stakeholder Voice
0.20 1 perspective
Speaks: institution
Temporal Framing
present unspecified
Geographic Scope
global
Complexity
technical high jargon domain specific
Transparency
0.50
✓ Author
Event Timeline 3 events
2026-02-26 00:08 eval_success Evaluated: Mild positive (0.14)
2026-02-25 23:49 eval_success Evaluated: Mild positive (0.27)
2026-02-25 23:49 eval_success Evaluated: Mild positive (0.16)
About HRCB | By Right | HN Guidelines | HN FAQ | Source | UDHR | RSS
build df0a3f9+qx7k · deployed 2026-02-26 00:16 UTC · evaluated 2026-02-26 00:18:51 UTC