G
G
GM2mars2013-11-27 11:19:04
PHP
GM2mars, 2013-11-27 11:19:04

Which is faster: php + jQuery .html() vs. AngularJS $scope?

The question is what will work faster and / and better: inserting a large piece of HTML code generated on the server and transmitted via Ajax and inserted on the client into the page using jQuery(".content").html(data) or transferring data from server as json string and dom generation via AngularJS template?
Details:
The data is a complex selection from the MySQL database, in the form of a large array (100 elements with ten parameters (strings and numbers) per query).
On the finished page with the display of elements there will be an "infinite scroll" (lazy load)

Ready-made html template for one element: (for an example of data volume)
<div class="class" data-par="item.data1" >
  <div class="class" title="item.data2"></div>
  <a href="item.data3" target="_blank" class="class">
    <div class="class">item.data4</div>
    <div class="class" title="...">item.data5</div>
  </a>
  <div class="class" style="item.data6">
    <a href="item.data3" target="_blank" class="class">
      <div class="class">
        <p class="class">item.data7</p>
      </div>
    </a>
    <div class="class">
      <ul class="class">
        <li class="class" title="...">
          <div class="class">item.data8</div>
          <span>item.data8</span>
        </li>
        <li class="class" title="...">
          <span class="class ">
            <div class="class">item.data9</div>
          </span>
        </li>
        <li class="class" title="...">
          <span class="class ">
            <div class="class">item.data10</div>
          </span>
        </li>
      </ul>
    </div>
  </div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Eliseev, 2013-11-27
@GM2mars

It's not that big of a deal. You will not feel the difference between jQuery and Angular. Therefore, choose what is more convenient to write on and what is more convenient to work with.
I think in order to feel the difference, it is necessary not to measure in the number of elements, but in the size of the text in MB. I saw in one project, up to 3MB of text is loaded into the page, then it is crushed, and displayed in a certain form - the browser, at the same time, strained but not much. So I think, at such volumes, it makes sense to measure performance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question