Implement a basic benchmark test, and deprecate derivation.map()/flatMap()

This starts a new workspace at `packages/benchmarks` where future benchmarks
are going to sit. For now, it only contains a basic profile of a `sequence.play()`
setup.

It also removes all uses of `AbstractDerivation.map()/flatMap()` and uses prisms
instead.
This commit is contained in:
Aria Minaei 2022-11-26 15:00:14 +01:00
parent 45b548660c
commit ae8be59366
26 changed files with 37584 additions and 56 deletions

View file

@ -4,7 +4,6 @@
import Atom, {val} from '../../Atom'
import Ticker from '../../Ticker'
import type {$FixMe, $IntentionalAny} from '../../types'
import ConstantDerivation from '../ConstantDerivation'
import iterateAndCountTicks from '../iterateAndCountTicks'
import prism, {PrismDerivation} from './prism'
@ -31,8 +30,8 @@ describe('prism', () => {
expect(changes).toMatchObject(['foo2boo'])
})
it('should only collect immediate dependencies', () => {
const aD = new ConstantDerivation(1)
const bD = aD.map((v) => v * 2)
const aD = prism(() => 1)
const bD = prism(() => aD.getValue() * 2)
const cD = prism(() => {
return bD.getValue()
})