Skip to content

토큰의 소유권을 editor에서 engine으로 #70

Description

@mundi4

Pros

  • Worker 전송 비용 제거 — string은 항상 structured clone(복사), Uint16Array는 transfer(zero-copy). 문서가 클수록 실질적 이득
  • buildDiffInput 단계 제거 — 이미 완성된 버퍼를 그대로 씀
  • 소유권 일관성 — 텍스트 데이터 수명이 Engine 안에서 완결
  • diffOptions → tokenize 흐름이 자연스러워지고, 나중에 granularity 같은 옵션도 동일 경로로 흐름

Cons

  • 디버깅 번거로움
  • tokenize에 공백 삽입 로직 추가 — 단, 분리 가능: tokenize는 raw Uint16Array만 만들고, Engine이 그 위에서 buildTextBuffer(tokens, rawBuffer, diffOptions) 한 번 더 호출하는 구조로 가면 tokenize는 지금처럼 순수하게 유지됨
  • String.fromCharCode(buffer.subarray(offset, offset+len)) — 어렵진 않음. 그냥 헬퍼 하나

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions