webarkit / webarkit/jsfeatNext

bench: finish imgproc coverage (12 unbenched methods) and pyramid_t.build

Open
#168 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
12
Forks
4
Avg merge
16h 24m
Merged PRs (30d)
34

Description

Summary

#86 phase 2 gave every module a bench file, but imgproc is only partly covered: of its 15 public methods, phase 1 benched twogaussian_blur and resample. pyramid_t.build is likewise unbenched.

This issue tracks closing that gap. It is measurement coverage only — no src/ changes, same rules as #86.

What is missing

Roughly in order of how much they matter to the per-frame WebAR path:

method why it matters
grayscale Runs on every frame, first step of the pipeline
pyrdown + pyramid_t.build Every frame for both the LK tracker and ORB
sobel_derivatives / scharr_derivatives Gradient maps
warp_perspective / warp_affine The AR overlay step; warp_affine also carries the #119 fix
compute_integral_image Not per-frame today, but #131 fixes it and the FREAK/TEBLID work (#80/#135) depends on it
canny Demo/example path; also the one imgproc method that constructs a matrix_t per call (imgproc.ts:834)
equalize_histogram, box_blur_gray Example paths; box_blur_gray carries the #114 fix
hough_transform, skindetector Peripheral — include only if cheap

Why bother, given phase 2 is "done"

Two of these already have correctness history — warp_affine (#119) and box_blur_gray (#114) — and neither has a throughput baseline, so a future refactor of either would be unmeasurable. compute_integral_image is about to gain consumers (#80/#135), and it is better to have its baseline before rather than after.

canny is worth calling out separately: it is the only imgproc method that constructs a matrix_t on every call, which is exactly the pattern #159 showed to be expensive. It may well be a finding waiting to be measured.

Conventions to follow

Everything in bench/README.md applies, in particular:

  • Read the ratio, never the hz.
  • Measure on an idle machine, discard a warm-up, take at least four samples — and note that four samples establish a direction, not a spread.
  • Both sides must do identical work; assert it outside the timed region where a count or a result can drift (see assertEqualCounts in detectors.bench.ts).
  • Size keypoint pools to the expected count plus headroom, never to the image.
  • bench()'s setup/teardown run once per mode, not per iteration; Vitest's standard hooks do not run at all in bench mode.

Acceptance criteria

  • Each method above either has a bench case or an explicit note in bench/README.md saying why it does not.
  • Measurements taken per the rules above, with the numbers recorded.
  • Any new finding added to the Current status table, not buried in a section.
  • npm test stays green; no src/ changes.

Related

  • Parent: #86 (phase 2 coverage)
  • Correctness history on two of these: #119, #114
  • Future consumers of compute_integral_image: #131, #80, #135
  • Open findings from the existing benches: tracked separately

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bench/README.md and the existing gaussian_blur and resample benches, then inspect imgproc.ts and detectors.bench.ts for the relevant patterns and assertions. Add coverage or an explicit README note for each listed method, record measurements and findings in the Current status table, and run npm test with no src/ changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-vision, performance, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.