Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 2, 2020 09:47 pm GMT

Which is more memory efficient in JavaScript: big arrays, or big strings with a comma separator?

I am working with big arrays, bug I want to know if I can compress it's content to be more memory effectiant, I am using:

mybigarray.includes(x)

and was wondering if it woild be more efficient to just do

mybigstring.includes(String(x))

would be slightly more effecient.

Q: Are Strings more memory effecient than Arrays? => if not, is there any way to compress an Array to save memory?

Thanks!
Cheers!


Original Link: https://dev.to/calin92540842/which-is-more-memory-efficient-in-javascript-big-arrays-or-big-strings-with-a-comma-separator-5e67

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To