Potential inefficiencies due to cyclic dependency
Author: s311354Created Jan 22, 2025Updated Jan 22, 2025
I just observed the recursive cycles from hashmap_put2 and rehash form in hashmap.c, which might impact on the potential infinite recursion or excessive dependency.
I think the we could allocate new buckets and just directly update existing hashmap during rehashing to reduce recursion and improving clarity.
In particular, using gprof to measure function-level performance, I noticed some interesting behavior. The proposed changes aimed to optimize get_or_insert_entry and reduce the recursive dependencies between hashmap_put2 and rehash.
I put the reduced recursive dependencies proposal at #154 for reference.
Source: rui314/chibicc