Skip to content

feat: benchmarking harness with shared fixtures for tests and benchmarks#31

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/implement-benchmarking-harness
Draft

feat: benchmarking harness with shared fixtures for tests and benchmarks#31
Copilot wants to merge 4 commits into
mainfrom
copilot/implement-benchmarking-harness

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

Establishes a shared fixture design so test data is defined once and reused by both unit tests and benchmarks. Each function now has three coordinated files: a fixture, a test (updated to import from it), and a bench.

Structure per function

sort-by.fixture.ts  ← exports representative data
sort-by.test.ts     ← imports from fixture (was inline)
sort-by.bench.ts    ← Deno.bench using same fixture

sort-by.fixture.ts

export const sortByFixture = [
  { id: 1, value: 10 },
  { id: 2, value: 5 },
  { id: 3, value: 20 },
]

sort-by.bench.ts

import { sortBy } from './sort-by.ts'
import { sortByFixture } from './sort-by.fixture.ts'

Deno.bench('sortBy', () => {
  sortBy(sortByFixture, 'value')
})

Scope

  • 82 fixture files and 82 bench files created across array, date, function, math, object, text
  • 24 test files updated to import representative data from fixtures; edge-case data stays inline
  • Root deno.json: added bench task (deno bench [!_]*/**/*.bench.ts)

Tooling fixes

  • docs:lint task updated to exclude *.fixture.ts and *.bench.ts from JSDoc lint (fixture exports are data, not public API)
  • _internal-tools/check-exports.ts updated to skip fixture/bench files when updating barrel mod.ts and deno.json exports

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.deno.land
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED bash k/ut�� in-by.fixture.ts (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED bash --no�� ange.fixture.ts (dns block)
  • jsr.io
    • Triggering command: /tmp/deno-bin/deno /tmp/deno-bin/deno test --doc --reporter=dot --coverage --parallel _internal-tools/check-exports.ts _internal-tools/check-imports.ts _internal-tools/check-links.ts _internal-tools/check-versions.ts _internal-tools/count-functions.ts _internal-tools/deno-config.ts array/collection-key-by.test.ts array/collection-key-by.ts array/common-elements.test.ts array/common-elements.ts array/count-by.test.ts array/count-by.ts array/filter-by-date.test.ts array/filter-by-date.ts (dns block)
    • Triggering command: ./deno ./deno test math/ --reporter=dot /hom�� elect-by.test.ts (dns block)
    • Triggering command: ./deno ./deno test math/ --reporter=dot --no-check et-difference.bench.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Please plan and implement this new design

[Chronological Review: The conversation began with the user expressing the need to set up a benchmarking harness for a library using Deno, seeking to utilize Deno's built-in features like Deno.bench and other utilities from the Deno ecosystem. The user then shifted focus to persisting and displaying benchmarking information, indicating a preference for leveraging existing packages rather than building from scratch. The user proposed having representative data fixtures for tests and benchmarks, suggesting a design where each function would have a specific fixture file. The user requested to implement this new design, leading to the current state of the conversation.]

[Intent Mapping:

  1. "I wanted to set up a benchmarking harness." - User's initial request for benchmarking solutions.
  2. "What about persisting this information (and versioning it)?" - Inquiry about data persistence and display.
  3. "It would be nice to have the same fixture... for the tests and the benchmarks." - Suggestion for a design improvement.
  4. "do it" - Direct command to implement the proposed design.
  5. "Please plan and implement this new design." - Request for a structured implementation plan.]

[Technical Inventory:

  • Deno: The user is utilizing Deno for their library, focusing on its built-in benchmarking capabilities.
  • Deno.bench: Identified as the most appropriate tool for benchmarking.
  • Fixtures: The concept of using representative data for tests and benchmarks was introduced.]

[Code Archaeology:

  • File: /Users/edouard/Documents/code/me/utils/benchmarks/utils.ts - This file is central to the user's benchmarking efforts and is where the proposed changes will be implemented.]

[Progress Assessment:

  • Completed: Initial discussions on benchmarking and persistence.
  • Pending: Implementation of the new design involving fixtures for tests and benchmarks.]

[Context Validation: The conversation has established a clear direction for implementing a benchmarking harness using Deno, with a focus on leveraging existing tools and creating a structured approach to data handling.]

[Recent Commands Analysis:

  • Last Agent Commands: The user requested to "do it" and then "Please plan and implement this new design."
  • Tool Results Summary: No specific tool results were returned as the conversation focused on planning and design rather than executing code.
  • Pre-Summary State: The agent was preparing to implement a new design for benchmarking and testing fixtures when the token budget was exceeded.
  • Operation Context: The commands were executed in the context of finalizing the design for benchmarking and establishing a clear structure for tests and benchmarks.]
1. Conversation Overview: - Primary Objectives: - "I wanted to set up a benchmarking harness." - "What about persisting this information (and versioning it)?" - "It would be nice to have the same fixture... for the tests and the benchmarks." - "do it" - "Please plan and implement this new design." - Session Context: The user is developing a benchmarking harness for a library in Deno, focusing on utilizing built-in features and existing packages for persistence and display. - User Intent Evolution: The user transitioned from seeking benchmarking solutions to proposing a structured design for tests and benchmarks, culminating in a request for implementation.
  1. Technical Foundation:
  • Deno: The user is using Deno for their library, emphasizing its ecosystem for benchmarking.
  • Deno.bench: Identified as the primary tool for benchmarking tasks.
  • Fixtures: The user proposed using representative data fixtures for both tests and benchmarks.
  1. Codebase Status:
  • File Name: utils.ts
  • Purpose: Central to the user's benchmarking efforts.
  • Current State: Awaiting implementation of the new design involving fixtures.
  • Key Code Segments: Not specified yet, as the implementation is pending.
  • Dependencies: Relates to the overall benchmarking and testing framework being developed.
  1. Problem Resolution:
  • Issues Encountered: None explicitly mentioned; focus has been on design and planning.
  • Solutions Implemented: No solutions have been implemented yet; the conversation is in the planning phase.
  • Debugging Context: No ongoing troubleshooting efforts mentioned.
  • Lessons Learned: The importance of structured data handling for benchmarking and testing.
  1. Progress Tracking:
  • Completed Tasks: Initial discussions on benchmarking and persistence.
  • Partially Complete Work: Implementation of the new design for fixtures is pending.
  • Validated Outcomes: None yet, as implementation has not begun.
  1. Active Work State:
  • Current Focus: Planning and implementing a new design for benchmarking and testing fixtures.
  • Recent Context: The user requested to implement the proposed design for fixtures.
  • Working Code: No specific code snippets discussed recently; focus is on design.
  • Immediate Context: The user ...

Created from VS Code.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 4, 2026

Not up to standards ⛔

🔴 Issues 11 medium

Alerts:
⚠ 11 issues (≤ 2 issues of at least medium severity)

Results:
11 new issues

Category Results
Compatibility 9 medium
UnusedCode 2 medium

View in Codacy

🟢 Metrics 4 complexity · -10 duplication

Metric Results
Complexity 4
Duplication -10

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI and others added 3 commits May 4, 2026 20:52
For each function in the array module:
- Create {function-name}.fixture.ts with representative test data
- Update {function-name}.test.ts to import data from fixture file
- Create {function-name}.bench.ts with Deno.bench benchmarks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: edouardmisset <63284636+edouardmisset@users.noreply.github.com>
…date modules

For each function across 5 modules, create:
- {function-name}.fixture.ts: representative test data exports
- {function-name}.bench.ts: Deno.bench benchmarks using fixture data

Updated test files:
- math/clamp.test.ts: moved top-level variables to clamp.fixture.ts
- math/range.test.ts: moved top-level variables to range.fixture.ts

Modules covered:
- math (16 functions): average-time, average, clamp, divmod, is-valid-number,
  normalize, percent, product, random (2 benches), range (4 benches),
  round-to-precision, scale, standard-deviation, sum, to-fixed-without-zero,
  valid-number-with-fallback
- function (11 functions): debounce, equals, is-empty, is-function, is-valid-json,
  memoization, pipe, sleep, throttle, time-it, try-catch
- object (12 functions): invert, is-key, is-not-nested-object, is-object,
  is-plain-object, map-object, object-keys, omit, pick, remove-nullish-values,
  shallow-equal, size
- text (8 functions): capitalize, levenshtein-distance, remove-accents, slugify,
  string-equals (2 benches), string-includes, string-to-boolean, wrap-in-parentheses
- date (13 functions): convert-string-date, datification, first-date-of-month,
  is-date-compatible, is-date-in-duration, is-date-in-last-12-months, is-date-in-range,
  is-date-in-year, is-valid-date, last-date-of-month, parse-date, sort-by-date,
  stringify-date

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: edouardmisset <63284636+edouardmisset@users.noreply.github.com>
…fixture/bench files

Agent-Logs-Url: https://github.com/edouardmisset/utils/sessions/502f5806-f89f-4232-8282-fdb3147c8f6b

Co-authored-by: edouardmisset <63284636+edouardmisset@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement new design for benchmarking harness in Deno feat: benchmarking harness with shared fixtures for tests and benchmarks May 4, 2026
Copilot AI requested a review from edouardmisset May 4, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants