diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-10-09 20:14:32 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-10-09 20:14:32 +0100 |
| commit | 90babbfbf30cc9c611af74e8c0af3562faf4d58b (patch) | |
| tree | 72fa8156a0dfececd67a3ad0943fa16661385503 /src/parser.cpp | |
| parent | 5bffa4ee793a891237538cb4d18754bed4d43748 (diff) | |
Very Basic Profiling
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index fb93c4609..32287af03 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2848,15 +2848,18 @@ ParseFileError init_ast_file(AstFile *f, String fullpath) { TokenizerInitError err = init_tokenizer(&f->tokenizer, fullpath); if (err == TokenizerInit_None) { array_init(&f->tokens, gb_heap_allocator()); - for (;;) { - Token token = tokenizer_get_token(&f->tokenizer); - if (token.kind == Token_Invalid) { - return ParseFile_InvalidToken; - } - array_add(&f->tokens, token); + { + PROF_SCOPED("Tokenize file"); + for (;;) { + Token token = tokenizer_get_token(&f->tokenizer); + if (token.kind == Token_Invalid) { + return ParseFile_InvalidToken; + } + array_add(&f->tokens, token); - if (token.kind == Token_EOF) { - break; + if (token.kind == Token_EOF) { + break; + } } } @@ -3044,6 +3047,8 @@ String get_filepath_extension(String path) { } void parse_file(Parser *p, AstFile *f) { + PROF_PROC(); + String filepath = f->tokenizer.fullpath; String base_dir = filepath; for (isize i = filepath.len-1; i >= 0; i--) { |