Improve hash performance

- better `TOK_HASH_FUNC`
- increases `hash_ident` initial size to 16k (from 8k)
- `cstr_cat` uses single `realloc` + `memcpy`
- `cstr_cat` can append terminating zero
- `tok_str_realloc` initial size to 16 (from 8)
- `parse_define` uses static `tokstr_buf`
- `next` uses static `tokstr_buf`
- fixes two latent bugs (wrong deallocations in libtcc.c:482 and
  tccpp.c:2987)
This commit is contained in:
Vlad Vissoultchev
2016-04-17 16:37:23 +03:00
parent acc8f602e5
commit 224236f57c
6 changed files with 105 additions and 97 deletions

View File

@ -3395,7 +3395,7 @@ ST_FUNC void parse_asm_str(CString *astr)
cstr_new(astr);
while (tok == TOK_STR) {
/* XXX: add \0 handling too ? */
cstr_cat(astr, tokc.str.data);
cstr_cat(astr, tokc.str.data, -1);
next();
}
cstr_ccat(astr, '\0');