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:
one year ago
by:
Guest
Go 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:
4 months 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
ShallowRef
41K/s
Ref
14K/s
Reactive
14K/s
View exact numbers
Test name
Executions per second
✓
ShallowRef
40,989 Ops/sec
Ref
14,480 Ops/sec
Reactive
14,119 Ops/sec
Related benchmarks
Vue Reactive vs Ref
Vue Reactive vs Ref vs ShallowRef
Vue Reactive vs ES statement
Vue vs REact
Comments
Confirm delete:
Do you really want to delete benchmark?