aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorVlad Vissoultchev <wqweto@gmail.com>2016-04-17 16:37:23 +0300
committerVlad Vissoultchev <wqweto@gmail.com>2016-04-17 17:25:55 +0300
commit224236f57c7d645c9b23d717de354df5d12b98b6 (patch)
tree27299b0ac2b9ec69d519c87bd5d8f5842346e0df /tcc.c
parentacc8f602e57d69e6e36c417b7b360b6dd685b64e (diff)
downloadtinycc-224236f57c7d645c9b23d717de354df5d12b98b6.tar.gz
tinycc-224236f57c7d645c9b23d717de354df5d12b98b6.tar.bz2
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)
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c7
1 files changed, 4 insertions, 3 deletions
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);