-3

I'm making my portfolio website here,

and I'm wondering if I should replace my LONG HTML5 code that populates my skills/projects/project modals into javascript that runs in a for loop.

I know it won't matter much because it is not like thousands of list elements, but if I take asymptotic approach, would it make difference at all?

I read this thread: Simple html vs Javascript generated html? , but it was still vague to me.

Thank you in advance.

EDIT

Someone voted that this post is unclear about what it's asking. So let me rephrase.

Assume that I'm populating almost infinite number of <li> elements, will HTML5 tags (traditional way) load the page faster, or forloop in a JavaScript load the page faster? Another assumption is that page will be loaded at some point.

Thanks again.

Community
  • 1
  • 1
Saehun Sean Oh
  • 2,103
  • 1
  • 21
  • 41
  • I think you're going to have to narrow the scope on this question a bit. To assume an "almost inifinite" number of `
  • ` elements makes it hard to know what you're asking and how to advise, since such a set of elements would take an "almost infinite" amount of time to build in JS or transmit from a server. Be a bit more realistic: are you talking about 100 `
  • ` elements, 1000, 100000, or 1M?
  • – Jonathan M Sep 21 '15 at 18:38
  • Most applications that involve a high number of elements of the same type are going to be pulling data for the elements from a database via AJAX and using some JS to plug the data into newly-created elements. Rarely do you see this all done on the server and then served to the client as a complete page. – Jonathan M Sep 21 '15 at 18:42
  • Markup is cheap, images are expensive. I would consider focusing on deferred and responsive loading of those before worrying about markup generation. – Jesse Kernaghan Sep 21 '15 at 18:48
  • Thank you guys. @JonathanM it could be 1000, 100000, or 1M. Would loading performance matter in different sizes of `
  • ` elements ? @Jesse Kernaghan I do understand images are expensive, but I appreciate your answer.
  • – Saehun Sean Oh Sep 21 '15 at 19:01
  • OK, you're also going to have to define "faster". Do you want to measure actual time? If so, from what event to what event? If not, are you wanting to measure client cycles, server cycles...? – Jonathan M Sep 21 '15 at 19:26
  • @jonathanM I think I just misunderstood the concept of DOM. Thank you. – Saehun Sean Oh Sep 21 '15 at 19:38