From 224236f57c7d645c9b23d717de354df5d12b98b6 Mon Sep 17 00:00:00 2001 From: Vlad Vissoultchev Date: Sun, 17 Apr 2016 16:37:23 +0300 Subject: 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) --- tcc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tcc.c') diff --git a/tcc.c b/tcc.c index e79e1fb..4431db8 100644 --- a/tcc.c +++ b/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); -- cgit v1.3.1