Commit Graph

4 Commits

Author SHA1 Message Date
abdussamedulutas 2b9888c021 perf(tokenizer): switch dispatch + unordered_map keyword lookup
Önceki: for döngüsü içinde her token için include() 63 kez çağrılıyordu
        → 66.9M include() çağrısı, zamanın %81'i

Sonraki:
  - Operatör/delimiter: switch(c0) + getchar(1) ile O(1) dispatch
  - Keyword: readIdentifier() → unordered_map::find() O(1) lookup
  - include() yalnızca // /* */ için (2-3 çağrı/yorum satırı)

Sonuç (2.3MB, 90K satır, debug build):
  tokens: 11.5s → 2.4s  (−79%)
  check:  12.7s → 3.7s  (−71%)

gprof ÖNCE: %81 include() (66.9M çağrı)
gprof SONRA: include() %0.00 — artık ölçülemez

Profil dosyaları: docs/perf-before.txt, docs/perf-after.txt

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 18:35:10 +03:00
abdussamedulutas aa4d9fb8c2 perf: include() parametresini std::string → std::string_view yap
Tokenizer her token için ~84 kez include() çağırıyor.
Önceki imza std::string (değer kopyası) aldığından her çağrıda
heap allocation yapılıyordu. string_view + explicit std::string()
cast'larının kaldırılmasıyla 2.3 MB dosyada tokens süresi
17.6s → 11.9s (−32%).

Kök neden: src/tokenizer/tokenizer.cpp satır 44/61/73'teki
std::string(kw/del/op) explicit cast'ları string_view tablolardan
gereksiz kopya üretiyordu.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 18:03:54 +03:00
abdussamedulutas 7c5a86c39b fix: kaynak dosya yolu propagasyonu ve AST JSON girinti hataları
- Tokenizer::scan artik filePath parametresi alip Lexer'a iletiyor;
  SourceLocation.file artik bos degil (Asama 0 tamamlandi).
- JsonObject::add icin const char* overload eklendi (kind: true bug'i).
- JsonObject acilis suslu parantezi girintisiz yaziliyor, addArray ilk
  eleman oncesi bos satir birakmiyor; LiteralNode/IdentifierNode toJson
  ayni sekilde duzeltildi.
- analysisToJson girinti seviyeleri "analysis" objesine gore duzeltildi.
2026-06-14 15:57:54 +03:00
abdussamedulutas 93cbc7db3a Gemini 2026-05-27 10:29:30 +03:00