I have a web app that contains a huge amount of generated JavaScript. The memory consumption differs by a factor 6 between running the web app in Chrome on a Desktop compared to running the web app in a UIWebView
on an (updated) iPad.
What constructs or patterns should I avoid to get the memory consumption on iOS on par with that of Chrome?
Characterisation of the generated JavaScript:
- The code is generated by Haxe.
- The code is "object oriented" in that it makes heavy use of
prototype
, but in a civilized way. - The code makes heavy use of named indexes on JavaScript objects to implement hash tables.
- There are a lot of strings, but hardly any string concatenations.
There does not appear to be any memory leaks; the excessive memory consumption on iOS shows immediately upon construction of the (fixed set of) Javascript objects.
v8
andjavascriptcore
to the tags so experts in those two JS engines can weigh in. – Dysentery