Closed davidwitten closed 2 months ago
The all map that was created by combining all language maps:
all
all: new Map([...itMap, ...enMap, ...esMap, ...frMap, ...deMap]),
is very computationally intensive and much slower than calling each of the maps individually.
I kept the logic the exact same as before, and all the tests pass.
I tested using getGender('davide')
getGender('davide')
Now
rss: 0 MB heapTotal: 0 MB heapUsed: 0.00218963623046875 MB external: 0.00003814697265625 MB arrayBuffers: 0 MB
Before
rss: 19.171875 MB heapTotal: 16.0625 MB heapUsed: 8.680007934570312 MB external: 0.00003814697265625 MB arrayBuffers: 0 MB
This optimization significantly reduces memory usage and improves execution speed.
@DavideViolante
Thank you for the contribution, that seems nice, I left you a comment and then I think it's ok to merge.
The
all
map that was created by combining all language maps:is very computationally intensive and much slower than calling each of the maps individually.
I kept the logic the exact same as before, and all the tests pass.
Performance impact:
Change in memory usage before/after
I tested using
getGender('davide')
Now
Before
This optimization significantly reduces memory usage and improves execution speed.