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:
7
tcc.c
7
tcc.c
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user