Use the same api to take about 20, 000 pieces of data, and use Vue and jQuery respectively to realize the picture representation. Which one should be faster?

use the same api to take about 20, 000 pieces of data, and use Vue and jQuery to realize the picture representation respectively. Which should be faster?

Oct.25,2021

for cycle to create 20, 000 pieces of data to try and ask questions here, which is faster?


vue:

<div id="app">
    <div v-for="item in list" :key="item.id">
      {{item.name}}
    </div>
  </div>
let list = []
for (let index = 0; index < 20000; indexPP) {
  list.push({
    id: index,
    name: `text${index}`
  })
}
new Vue({
  el: '-sharpapp',
  data: {
    list: []
  },
  created () {
    console.time('vue')
    this.list = list
    this.$nextTick(() => {
      console.timeEnd('vue')
    })
  }
})

clipboard.png

jq


clipboard.png

this is a single test. You can take the average multiple times


list.forEach ((item) = > {
$('- sharpapp'). Append (`
)
<div>
  ${item.name}
</div>

`)
})

Big Brother you have a problem with your own writing in this place. You should first concatenate the strings and then use append

.

https://jsfiddle.net/qm0ysuza/2/

vue: 276.24609375ms
jq: 139.526123046875ms

directly manipulating dom manually is definitely the fastest when you know exactly how the data changes.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46440-59bec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46440-59bec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?