# [Typia] Hidden class optimization of v8 engine

> Clean Markdown view of GeekNews topic #10208. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=10208](https://news.hada.io/topic?id=10208)
- GeekNews Markdown: [https://news.hada.io/topic/10208.md](https://news.hada.io/topic/10208.md)
- Type: news
- Author: [samchon](https://news.hada.io/@samchon)
- Published: 2023-08-06T14:59:00+09:00
- Updated: 2023-08-06T14:59:00+09:00
- Original source: [dev.to](https://dev.to/samchon/secret-of-typia-how-it-could-be-20000x-faster-validator-hidden-class-optimization-in-v8-engine-1mfb)
- Points: 6
- Comments: 0

## Topic Body

- Typia가 TS runtime validator 중 가장 빠른 이유를 이론적으로 설명  
- JS와 같은 동적 언어는 모든 객체가 HashMap<string, Object>  
  - 아무 키나 넣고 빼고 가능한 게 이 덕분  
  - 대신 정적인 클래스 구조 대비 느림  
  - HashMap은 내부적으로 원소들을 링크드 리스트에 저장하기 때문  
- V8 Engine은 Hidden Class Optimization 이라는 게 있음  
  - 동적으로 제어하는 요소가 없다 싶으면 HashMap 사용 안 하고  
  - 그 대신 정적인 클래스 구조로 변환하여 사용  
  - 정적인 클래스는 멤버들이 메모리 상 연속되어 성능에 유리  
- Typia는 각 타입에 대한 검증 코드를 정적으로 생성 (AoT compilation)  
- 다른 runtime validator 들은 동적인 로직 사용 (for key in obj)  
- 이것이 Typia가 다른 runtime validator들보다 빠른 이유

## Comments



_No public comments on this page._
