#record<string, string> better or map<string, string>?

7 messages · Page 1 of 1 (latest)

granite junco
#

record<string, string> better or map<string, string>?
in terms of memory, garbage-collector, etc

it is in a flow getting triggered everytime we receive an API request

wooden falcon
#

I would say use a Record unless you have some specific need for a map

fervent pulsar
#

Map<K, V> can be very performant, even more than regular objects

#

however, if you create objects with well known keys and always provide all the keys when building the object (even if you set the values to undefined), then then engine can also optimize your code

#

really depends what you're trying to do, how many reads and writes you'll have, etc.

#

@granite junco

granite junco
#

the case if just i get a structure in an API request
i am iterating the structure and creating a map between playerId and playertype