We need to compare the runtime performance of three different ways to access object properties in a large dataset of JavaScript objects. Each object contains 100 fields named in `snake_case`. The three approaches are:
snake_case
keys (e.g. obj['first_name']
).
snake_case
fields are converted once to camelCase
and the objects overwritten
accordingly; access then uses the new camelCase
keys (e.g. obj['firstName']
).
Proxy
that intercepts property
lookups and transparently maps camelCase
accessors to the underlying snake_case
fields.