Flutter 기본 공부 정리(WIP)

DevLETi·2024년 1월 18일
post-thumbnail

Flutter 들어가기 전에

Dart compiler

Dart_Compiler
Dart Compiler는 Dart로 작성된 소스코드를 dart virtual machine에서 작동되도록 중간 언어 또는 기계어로 바꿔주는 툴이다.

Architecture에 따른 사용 compiler 종류

Dart는 Dart 언어를 변환할 때 용도(Development/Product)에 따라 다른 compiler를 사용한다.
JIT/AOT,dartdevc/dart2js

  • CPU Architecture(ARM32, ARM64, X86_64)
    • Development - JIT(Just In Time) Compiler
    • Product - AOT(Ahead Of Time) Compiler
  • Web(Javascript)
    • Development - dartdevc
    • Product - dart2js

→ 왜 용도/목적에 따라 다른 compiler를 사용하는거지?

JIT? AOT?

Development Phase - Just In Time Compiler(JIT)

JIT

  • JIT는 필요한 code만 compile한다.
    • Runtime 환경에서 compile 하기 때문에 성능이 중요한 Production 상황에서는 적합하지 않음.
  • JIT는 incremental recompilation이 가능하기 때문에 필요할 경우 수정된 부분만 recompile이 가능하다.
  • 이는 Hot Reload라는 기능을 사용할 수 있도록 한다.
    • 개발시 수정한 부분만 빠르게 적용해 확인할 수 있음. 매번 모든 코드를 recompile할 필요가 없기 때문에 생산성 부분에서 이점을 가져갈 수 있다.

Production Phase - Ahead Of Time Compiler(AOT)

AOT

  • AOT는 모든 code를 기계어로 compile 한다.
  • Debug tool 없음
  • 성능 중시: production phase에 적합함.

JIT vs AOT

JIT_vs_AOT

  • Debug 관련해서는 JIT가 적합, 특히 Hot Reload
  • Start time 및 Run time을 고려하면 AOT가 적합

→ 생산성을 중시하는 Production Phase에는 Hot Reload가 가능한 JIT, 성능을 중시하는 Production Phase에는 모든 Code를 최적화하는 AOT Compiler를 사용한다.


Flutter

공부하다가 든 생각:

javascript 기반 react native로 개발하면 dart라는 새로운 언어 안배워도 되는데 왜 flutter를 쓰지?

Rendering Procedures

Rendering (React Native vs Flutter)

React_Native_vs_Flutter


출처

How does dart VM work? - Raahavaijth
Flutter architectural overview
[Flutter] 3. 플러터의 렌더링
Flutter vs. React Native - detailed framework comparison

profile
アイコン:https://x.com/xx_chon_xx

0개의 댓글