Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Vue Reactive vs Ref vs ShallowRef. Arrays
(version: 1)
Comparing performance of:
Reactive vs Ref vs ShallowRef
Created:
11 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://unpkg.com/vue@3"></script>
Tests:
Reactive
const {reactive, computed} = Vue; const dataTest = new Array(1000).fill(0).map((el, index) => ({id: index, name: `${index}`})) const v = reactive({ foo: dataTest }); const bar = v.foo; const frog = computed(()=>{ return [...v.foo, {id: -1, name: '-1', }]; }); v.foo = new Array(1000).fill(0).map((el, index) => ({id: index + 1, name: `${index + 1}`}))
Ref
const {ref, computed} = Vue; const dataTest = new Array(1000).fill(0).map((el, index) => ({id: index, name: `${index}`})) const foo = ref(dataTest); const bar = foo.value; const frog = computed(()=>{ return [...v.foo, {id: -1, name: '-1', }]; }); foo.value = new Array(1000).fill(0).map((el, index) => ({id: index + 1, name: `${index + 1}`}))
ShallowRef
const {shallowRef, computed} = Vue; const dataTest = new Array(1000).fill(0).map((el, index) => ({id: index, name: `${index}`})) const foo = shallowRef(dataTest); const bar = foo.value; const frog = computed(()=>{ return [...v.foo, {id: -1, name: '-1', }]; }); foo.value = new Array(1000).fill(0).map((el, index) => ({id: index + 1, name: `${index + 1}`}))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Reactive
Ref
ShallowRef
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36
Browser/OS:
Chrome Mobile 146 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Reactive
14119.3 Ops/sec
Ref
14480.5 Ops/sec
ShallowRef
40989.3 Ops/sec
Related benchmarks:
delete vs this.$delete
vue updated vs watch
Vue Reactive vs Ref
Vue Reactive literal vs Vue Reactive class vs Ref multiple
Vue Reactive vs Ref vs ShallowRef
Vue Reactive vs ES statement
Vue Reactive vs Ref both objects
fghjkt 6 and at max 200 characters long.
Vue vs REact
Comments
Confirm delete:
Do you really want to delete benchmark?