Comfy-Org / Comfy-Org/ComfyUI_frontend

Optimize monotone interpolator by precomputing segment constants

Open
#9,111 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
perf:speed
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

## Context

A performance optimization opportunity was identified in the `createMonotoneInterpolator` function added in PR #8860.

## Suggestion

Precompute per-segment data (dx, m0dx, m1dx) to reduce the number of array reads and multiplications during interpolation evaluation. This would cache segment-level constants once during setup rather than recomputing them on every evaluation call.

## References

- PR: #8860
- Original suggestion: https://github.com/Comfy-Org/ComfyUI_frontend/pull/8860#discussion_r2838858980
- Suggested by: @christian-byrne

## File

`src/components/curve/curveUtils.ts`

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-9111-Optimize-monotone-interpolator-by-precomputing-segment-constants-3106d73d3650818c95eecee3f3584a0e) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.