perf: Parallelized grammar loading.

This commit is contained in:
Spencer Brower
2026-07-25 14:02:49 -04:00
parent 18596bb37d
commit c913424d41
7 changed files with 302 additions and 281 deletions
+15
View File
@@ -15,6 +15,15 @@ when SPALL {
spall_ctx: spall.Context
@(thread_local)
spall_buffer: spall.Buffer
init_spall_for_thread :: proc() {
backing := make([]u8, spall.BUFFER_DEFAULT_SIZE, context.temp_allocator)
spall_buffer = spall.buffer_create(backing, u32(sync.current_thread_id()))
}
cleanup_spall_for_thread :: proc() {
spall.buffer_destroy(&spall_ctx, &spall_buffer)
}
}
main :: proc() {
@@ -40,6 +49,12 @@ main :: proc() {
context.logger = console_logger
defer log.destroy_console_logger(console_logger)
treesitter.init_persistent()
when SPALL {
treesitter.set_thread_callbacks(init_spall_for_thread, cleanup_spall_for_thread)
}
for {
defer free_all(context.temp_allocator)
tick := time.tick_now()