CaptEmulation / clash-of-clans-api

:star::star::star: Clash of Clans :rage1: API NodeJS helper
MIT License
64 stars 25 forks source link

modules update to latest version, and fixing memory leak caused by .slice() function #18

Closed ionutale closed 3 years ago

ionutale commented 4 years ago

i make a huge amount of request each day, and slice was causing issues. after some research and app profiling, it lead me to clash-of-clans-api module. more specific, the slice() method

here are some links to backup my change

and this answer is confirming that slice could create memory leaks https://stackoverflow.com/a/36851196

this is your code: https://stackoverflow.com/a/1026087 this is a guy that did some benchmark: https://stackoverflow.com/a/33704783 in this answer, there is a comment that is saying: "Note as well, that replacing .slice(1) with .substr(1) would enhance performance even further. "

also here look at the comments https://stackoverflow.com/a/49366757

this answer suggest substring :https://stackoverflow.com/a/33980745

CaptEmulation commented 4 years ago

Sorry this update slipped my notice. Will review and release new version

CaptEmulation commented 4 years ago

It's not a memory leak per se but it is uneeded memory thrashing and extra work for the garbage collector.

CaptEmulation commented 3 years ago

better later than never. This has been published as 0.6.4

ionutale commented 3 years ago

😁💪👍

Il giorno lun 23 nov 2020 alle 23:57 John Dean notifications@github.com ha scritto:

better later than never. This has been published as 0.6.4

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/CaptEmulation/clash-of-clans-api/pull/18#issuecomment-732474476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATRTF453QL3XSUDTN33FMTSRLSG7ANCNFSM4LQDXOIA .