reactiveObject.bench.ts 365 B

123456789101112131415161718192021
  1. import { bench } from 'vitest'
  2. import { reactive } from '../dist/reactivity.esm-browser.prod'
  3. bench('create reactive obj', () => {
  4. reactive({ a: 1 })
  5. })
  6. {
  7. const r = reactive({ a: 1 })
  8. bench('read reactive obj property', () => {
  9. r.a
  10. })
  11. }
  12. {
  13. let i = 0
  14. const r = reactive({ a: 1 })
  15. bench('write reactive obj property', () => {
  16. r.a = i++
  17. })
  18. }