Represent byte, char and tree counts as 32 bit numbers
The parser spends the majority of its time allocating and freeing trees and stack nodes. Also, the memory footprint of the AST is a significant concern when using tree-sitter with large files. This library is already unlikely to work very well with source files larger than 4GB, so representing rows, columns, byte lengths and child indices as unsigned 32 bit integers seems like the right choice.
This commit is contained in:
parent
11e767bd81
commit
535879a2bd
25 changed files with 268 additions and 263 deletions
|
|
@ -8,7 +8,7 @@ static const TSParseAction ERROR_SHIFT_EXTRA = {
|
|||
|
||||
void ts_language_table_entry(const TSLanguage *self, TSStateId state,
|
||||
TSSymbol symbol, TableEntry *result) {
|
||||
size_t action_index;
|
||||
uint32_t action_index;
|
||||
if (symbol == ts_builtin_sym_error) {
|
||||
if (state == ERROR_STATE) {
|
||||
result->action_count = 1;
|
||||
|
|
@ -30,7 +30,7 @@ void ts_language_table_entry(const TSLanguage *self, TSStateId state,
|
|||
result->actions = (const TSParseAction *)(entry + 1);
|
||||
}
|
||||
|
||||
size_t ts_language_symbol_count(const TSLanguage *language) {
|
||||
uint32_t ts_language_symbol_count(const TSLanguage *language) {
|
||||
return language->symbol_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue