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

7
tcc.c
View File

@ -237,9 +237,10 @@ static char *default_outputfile(TCCState *s, const char *first_file)
static int64_t getclock_us(void)
{
#ifdef _WIN32
struct _timeb tb;
_ftime(&tb);
return (tb.time * 1000LL + tb.millitm) * 1000LL;
LARGE_INTEGER frequency, t1;
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
return t1.QuadPart * 1000000LL / frequency.QuadPart;
#else
struct timeval tv;
gettimeofday(&tv, NULL);