Enhance application performance and user experience by enabling component caching in next.config.ts, optimizing database queries in various pages, and implementing lazy loading for heavy components. Updated styles for smoother transitions and improved visual clarity in multiple components, including globals.css and landing sections.
All checks were successful
Deploy / deploy (push) Successful in 2m30s

This commit is contained in:
bilalgursen
2026-08-01 14:00:22 +03:00
parent acb3b9d557
commit 569b9e5da2
29 changed files with 458 additions and 126 deletions

36
scripts/db-index.ts Normal file
View File

@@ -0,0 +1,36 @@
// Sorgu yolundaki ifade indexi + WAL bakımı. Bir kez çalıştırılır
// (pnpm tsx scripts/db-index.ts); ingest/refresh sonrası da güvenle
// tekrar çalıştırılabilir (IF NOT EXISTS).
//
// src/lib/db.ts tüm aralık sorgularını COALESCE(sira2025, sira2024)
// üzerinden yapar; SQLite ifade indexleri METİNSEL eşleştiği için buradaki
// ifade oradaki EFEKTIF_SIRA sabitiyle birebir aynı olmalıdır. Bu index
// olmadan her sorgu tur-partisyonunu tarayıp temp B-tree ile sıralıyordu.
import path from "node:path";
import Database from "better-sqlite3";
const db = new Database(path.join(process.cwd(), "data", "yokatlas.db"));
db.exec(`
CREATE INDEX IF NOT EXISTS idx_programs_tur_onlisans_efektif
ON programs (tur, onlisans, COALESCE(sira2025, sira2024));
`);
// Uygulama DB'yi readonly açtığı için checkpoint yapamaz; şişen WAL'i
// (okuma başına ekstra maliyet) burada dosyaya geri yaz ve sıfırla.
db.pragma("wal_checkpoint(TRUNCATE)");
const plan = db
.prepare(
`EXPLAIN QUERY PLAN
SELECT id FROM programs
WHERE tur = ? AND onlisans = ?
AND COALESCE(sira2025, sira2024) IS NOT NULL
AND COALESCE(sira2025, sira2024) BETWEEN ? AND ?
ORDER BY COALESCE(sira2025, sira2024) ASC LIMIT 10`,
)
.all("SAYISAL", 0, 1000, 50000);
console.log("Sorgu planı:", JSON.stringify(plan, null, 2));
db.close();

View File

@@ -119,6 +119,14 @@ async function main() {
`);
}
// Sorgu yolunun kullandığı ifade indexi; ifade src/lib/db.ts EFEKTIF_SIRA
// ile birebir aynı olmalı (bkz. scripts/db-index.ts). sira2025 kolonu
// yukarıda garanti edildikten sonra kurulur.
db.exec(`
CREATE INDEX IF NOT EXISTS idx_programs_tur_onlisans_efektif
ON programs (tur, onlisans, COALESCE(sira2025, sira2024));
`);
const update = db.prepare(`
UPDATE programs SET sira2025 = ?, puan2025 = ?, kontenjan2025 = ?, yerlesen2025 = ?
WHERE id = ?