DOM vs Array - memory use
For example I have a list of 100 strings, and 100 span's with this strings. How do you think, how 开发者_开发问答much span's takes more memory than array of strings. Is there possibility to measure? Is there optmisation to unvisible DOM?
This is a very small amount of data. I suggest that you concentrate on the functionality first, instead of optimizing something that's probably quite fast :). If you encounter performance problems (and your profiler says that's the hot spot), do something about it. I think you're doing a little premature optimization here, which is described in detail both on the web and on Stackoverflow in general.
Have you considered doing a test to see this? If you use a browser like Chrome you have access to advanced memory related information.
It would seem that creating 100 strings would use around 400-600 byte's. 100 spans however would depend on the browsers implementation and how it handles memory allocation etc...
精彩评论