• Karsten Blees's avatar
    hashmap: add string interning API · 7b64d42d
    Karsten Blees authored
    Interning short strings with high probability of duplicates can reduce the
    memory footprint and speed up comparisons.
    
    Add strintern() and memintern() APIs that use a hashmap to manage the pool
    of unique, interned strings.
    
    Note: strintern(getenv()) could be used to sanitize git's use of getenv(),
    in case we ever encounter a platform where a call to getenv() invalidates
    previous getenv() results (which is allowed by POSIX).
    Signed-off-by: default avatarKarsten Blees <blees@dcon.de>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    7b64d42d
test-hashmap.c 6.14 KB