jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: isEqual with large Float64Arrays is slow

Open akeating opened this issue 1 year ago • 2 comments

Version

29.7.0

Steps to reproduce

  1. Clone my repo https://github.com/akeating/jest-expect-isequal-perf.git
  2. npm install
  3. npm test

Expected behavior

expect.isEqual with large Float64Arrays performs inline with lodash at around 5ms

Actual behavior

expect.isEqual with large Float64Arrays takes around 600ms

Additional context

No response

Environment

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Pro
Binaries:
  Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn: 4.0.2 - ~/.nvm/versions/node/v20.10.0/bin/yarn
  npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
  pnpm: 9.1.2 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  bun: 1.1.10 - /opt/homebrew/bin/bun
npmPackages:
  jest: ^29.7.0 => 29.7.0

akeating avatar Jul 10 '24 17:07 akeating

Thanks for the great reproduction 👍

I've got a fix for this in https://github.com/jestjs/jest/pull/15178, but only when using toStrictEqual (although it also makes toEqual use 100m instead of 500ms). As mentioned there, it might make sense to properly support ArrayBuffer/TypedArray equality in toEqual as well

SimenB avatar Jul 11 '24 10:07 SimenB

First step https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.6

SimenB avatar Aug 08 '24 07:08 SimenB

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Sep 07 '24 08:09 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Oct 07 '24 08:10 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Oct 07 '24 08:10 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

github-actions[bot] avatar Nov 07 '24 00:11 github-actions[bot]