Skip to content

⚡️ Speed up function annotation_params_for_line by 276% #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codeflash-ai[bot]
Copy link

@codeflash-ai codeflash-ai bot commented May 24, 2025

📄 276% (2.76x) speedup for annotation_params_for_line in plotly/shapeannotation.py

⏱️ Runtime : 2.10 milliseconds 558 microseconds (best of 311 runs)

📝 Explanation and details

Here is the optimized version of your Python program. The major performance bottlenecks are in the _mean, _argmin, _argmax, and _prepare_position functions, as indicated by the line profiler results, and in the repeated building and scanning of sets in annotation_params_for_line.

Key optimizations.

  • _mean: Avoids double computation of len(x) and sum(x).
  • _argmin/_argmax: Avoids sorted and uses a fast linear scan.
  • _prepare_position: Use tuple for position keys and memoize set/tuple results for the most common positions to avoid repeated .split() and set() overhead.
  • annotation_params_for_line: Precompute all values in a single pass, avoid repeated calls to helper functions, and speed up positional checks using sets and tuple lookups.
  • Constants outside the hot loop.

All function signatures and return values are preserved. All comments are preserved except where the code is directly impacted.

Summary of optimizations:

  • Median, argmin, and argmax are inlined and linear, not sorted or repeated.
  • String splits and set conversions for common positions are cached/memoized.
  • All precomputable values are computed once, with special-case optimization for length-2 lists.
  • Fast lookup tables and lambda functions for annotation return logic.
  • Redundant/minor computations are removed.

This rework will significantly reduce the time spent per call, especially in tight event loops or repeated annotation applications.

Correctness verification report:

Test Status
⚙️ Existing Unit Tests 🔘 None Found
🌀 Generated Regression Tests 689 Passed
⏪ Replay Tests 🔘 None Found
🔎 Concolic Coverage Tests 🔘 None Found
📊 Tests Coverage 100.0%
🌀 Generated Regression Tests Details
import pytest  # used for our unit tests
from plotly.shapeannotation import annotation_params_for_line

# unit tests

# -----------------
# BASIC TEST CASES
# -----------------

def test_vline_top_left():
    # Test vline with position 'top left'
    args = {"x0": 1, "x1": 1, "y0": 0, "y1": 10}
    codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_vline_top_right():
    # Test vline with position 'top right'
    args = {"x0": 2, "x1": 2, "y0": 5, "y1": 15}
    codeflash_output = annotation_params_for_line("vline", args, "top right"); result = codeflash_output

def test_vline_bottom_left():
    # Test vline with position 'bottom left'
    args = {"x0": -1, "x1": -1, "y0": -10, "y1": 0}
    codeflash_output = annotation_params_for_line("vline", args, "bottom left"); result = codeflash_output

def test_vline_bottom_right():
    # Test vline with position 'bottom right'
    args = {"x0": 0, "x1": 0, "y0": 2, "y1": 8}
    codeflash_output = annotation_params_for_line("vline", args, "bottom right"); result = codeflash_output

def test_vline_top():
    # Test vline with position 'top'
    args = {"x0": 3, "x1": 3, "y0": 1, "y1": 9}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_vline_bottom():
    # Test vline with position 'bottom'
    args = {"x0": 4, "x1": 4, "y0": 7, "y1": 17}
    codeflash_output = annotation_params_for_line("vline", args, "bottom"); result = codeflash_output

def test_vline_left():
    # Test vline with position 'left'
    args = {"x0": 5, "x1": 5, "y0": 10, "y1": 20}
    codeflash_output = annotation_params_for_line("vline", args, "left"); result = codeflash_output

def test_vline_right():
    # Test vline with position 'right'
    args = {"x0": 6, "x1": 6, "y0": 12, "y1": 24}
    codeflash_output = annotation_params_for_line("vline", args, "right"); result = codeflash_output

def test_hline_top_left():
    # Test hline with position 'top left'
    args = {"x0": 1, "x1": 9, "y0": 2, "y1": 2}
    codeflash_output = annotation_params_for_line("hline", args, "top left"); result = codeflash_output

def test_hline_top_right():
    # Test hline with position 'top right'
    args = {"x0": 4, "x1": 8, "y0": 5, "y1": 5}
    codeflash_output = annotation_params_for_line("hline", args, "top right"); result = codeflash_output

def test_hline_bottom_left():
    # Test hline with position 'bottom left'
    args = {"x0": 0, "x1": 10, "y0": 3, "y1": 3}
    codeflash_output = annotation_params_for_line("hline", args, "bottom left"); result = codeflash_output

def test_hline_bottom_right():
    # Test hline with position 'bottom right'
    args = {"x0": 5, "x1": 15, "y0": 7, "y1": 7}
    codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result = codeflash_output

def test_hline_top():
    # Test hline with position 'top'
    args = {"x0": 2, "x1": 4, "y0": 11, "y1": 11}
    codeflash_output = annotation_params_for_line("hline", args, "top"); result = codeflash_output

def test_hline_bottom():
    # Test hline with position 'bottom'
    args = {"x0": 6, "x1": 10, "y0": 1, "y1": 1}
    codeflash_output = annotation_params_for_line("hline", args, "bottom"); result = codeflash_output

def test_hline_left():
    # Test hline with position 'left'
    args = {"x0": 3, "x1": 7, "y0": 8, "y1": 8}
    codeflash_output = annotation_params_for_line("hline", args, "left"); result = codeflash_output

def test_hline_right():
    # Test hline with position 'right'
    args = {"x0": 2, "x1": 12, "y0": 4, "y1": 4}
    codeflash_output = annotation_params_for_line("hline", args, "right"); result = codeflash_output

def test_vline_default_position_none():
    # Test vline with position None (should default to "top right")
    args = {"x0": 7, "x1": 7, "y0": 2, "y1": 9}
    codeflash_output = annotation_params_for_line("vline", args, None); result = codeflash_output

def test_hline_default_position_none():
    # Test hline with position None (should default to "top right")
    args = {"x0": 1, "x1": 5, "y0": 2, "y1": 2}
    codeflash_output = annotation_params_for_line("hline", args, None); result = codeflash_output

# -----------------
# EDGE TEST CASES
# -----------------

def test_vline_identical_points():
    # Test vline where both points are identical
    args = {"x0": 0, "x1": 0, "y0": 0, "y1": 0}
    codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_hline_identical_points():
    # Test hline where both points are identical
    args = {"x0": 5, "x1": 5, "y0": 5, "y1": 5}
    codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result = codeflash_output

def test_vline_negative_coordinates():
    # Test vline with negative coordinates
    args = {"x0": -3, "x1": -3, "y0": -10, "y1": -2}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_hline_negative_coordinates():
    # Test hline with negative coordinates
    args = {"x0": -8, "x1": -2, "y0": -4, "y1": -4}
    codeflash_output = annotation_params_for_line("hline", args, "left"); result = codeflash_output

def test_vline_slanted():
    # Test vline with slanted line (different y0/y1, same x)
    args = {"x0": 2, "x1": 2, "y0": 2, "y1": 8}
    codeflash_output = annotation_params_for_line("vline", args, "right"); result = codeflash_output

def test_hline_slanted():
    # Test hline with slanted line (different x0/x1, same y)
    args = {"x0": 1, "x1": 9, "y0": 3, "y1": 3}
    codeflash_output = annotation_params_for_line("hline", args, "top right"); result = codeflash_output

def test_hline_x0_greater_than_x1():
    # Test hline with x0 > x1
    args = {"x0": 10, "x1": 2, "y0": 4, "y1": 4}
    codeflash_output = annotation_params_for_line("hline", args, "left"); result = codeflash_output

def test_vline_y0_greater_than_y1():
    # Test vline with y0 > y1
    args = {"x0": 2, "x1": 2, "y0": 10, "y1": 0}
    codeflash_output = annotation_params_for_line("vline", args, "bottom right"); result = codeflash_output

def test_invalid_shape_type():
    # Test invalid shape_type raises ValueError
    args = {"x0": 0, "x1": 1, "y0": 0, "y1": 1}
    with pytest.raises(ValueError):
        annotation_params_for_line("foo", args, "top left")

def test_invalid_position_string():
    # Test invalid position string raises ValueError
    args = {"x0": 0, "x1": 1, "y0": 0, "y1": 1}
    with pytest.raises(ValueError):
        annotation_params_for_line("vline", args, "middle nowhere")

def test_missing_x0():
    # Test missing x0 in shape_args raises KeyError
    args = {"x1": 1, "y0": 0, "y1": 1}
    with pytest.raises(KeyError):
        annotation_params_for_line("vline", args, "top left")

def test_missing_y1():
    # Test missing y1 in shape_args raises KeyError
    args = {"x0": 0, "x1": 1, "y0": 0}
    with pytest.raises(KeyError):
        annotation_params_for_line("hline", args, "top right")

def test_case_insensitive_position():
    # Test that positions are case sensitive (should fail if case is wrong)
    args = {"x0": 1, "x1": 1, "y0": 1, "y1": 2}
    with pytest.raises(ValueError):
        annotation_params_for_line("vline", args, "Top Left")

def test_position_with_extra_spaces():
    # Test that extra spaces in position string are not allowed
    args = {"x0": 1, "x1": 1, "y0": 1, "y1": 2}
    with pytest.raises(ValueError):
        annotation_params_for_line("vline", args, " top left ")

def test_vline_float_coordinates():
    # Test vline with float coordinates
    args = {"x0": 1.5, "x1": 1.5, "y0": 2.5, "y1": 8.5}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_hline_float_coordinates():
    # Test hline with float coordinates
    args = {"x0": 3.2, "x1": 7.8, "y0": 5.5, "y1": 5.5}
    codeflash_output = annotation_params_for_line("hline", args, "right"); result = codeflash_output

# -----------------
# LARGE SCALE TEST CASES
# -----------------

def test_vline_large_range():
    # Test vline with large range values
    args = {"x0": 100, "x1": 100, "y0": 0, "y1": 999}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_hline_large_range():
    # Test hline with large range values
    args = {"x0": 0, "x1": 999, "y0": 500, "y1": 500}
    codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result = codeflash_output

def test_vline_many_calls():
    # Test many calls in a loop to check for performance/scalability
    for i in range(100):
        args = {"x0": i, "x1": i, "y0": i, "y1": i+10}
        codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_hline_many_calls():
    # Test many calls in a loop to check for performance/scalability
    for i in range(100):
        args = {"x0": i, "x1": i+10, "y0": 2*i, "y1": 2*i}
        codeflash_output = annotation_params_for_line("hline", args, "left"); result = codeflash_output

def test_vline_extreme_values():
    # Test vline with extreme float values
    args = {"x0": 1e308, "x1": 1e308, "y0": -1e308, "y1": 1e308}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_hline_extreme_values():
    # Test hline with extreme float values
    args = {"x0": -1e308, "x1": 1e308, "y0": 0, "y1": 0}
    codeflash_output = annotation_params_for_line("hline", args, "right"); result = codeflash_output
# codeflash_output is used to check that the output of the original code is the same as that of the optimized code.

import pytest  # used for our unit tests
from plotly.shapeannotation import annotation_params_for_line

# unit tests

# 1. BASIC TEST CASES

def test_vline_top_left():
    # vline, top left
    args = {"x0": 1, "x1": 1, "y0": 0, "y1": 10}
    codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_vline_top_right():
    # vline, top right
    args = {"x0": 2, "x1": 2, "y0": 0, "y1": 5}
    codeflash_output = annotation_params_for_line("vline", args, "top right"); result = codeflash_output

def test_vline_top():
    # vline, top
    args = {"x0": 3, "x1": 3, "y0": 1, "y1": 7}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_vline_bottom_left():
    # vline, bottom left
    args = {"x0": 4, "x1": 4, "y0": 2, "y1": 8}
    codeflash_output = annotation_params_for_line("vline", args, "bottom left"); result = codeflash_output

def test_vline_bottom_right():
    # vline, bottom right
    args = {"x0": 5, "x1": 5, "y0": 3, "y1": 9}
    codeflash_output = annotation_params_for_line("vline", args, "bottom right"); result = codeflash_output

def test_vline_bottom():
    # vline, bottom
    args = {"x0": 6, "x1": 6, "y0": 4, "y1": 12}
    codeflash_output = annotation_params_for_line("vline", args, "bottom"); result = codeflash_output

def test_vline_left():
    # vline, left
    args = {"x0": 7, "x1": 9, "y0": 5, "y1": 15}
    codeflash_output = annotation_params_for_line("vline", args, "left"); result = codeflash_output

def test_vline_right():
    # vline, right
    args = {"x0": 8, "x1": 10, "y0": 6, "y1": 16}
    codeflash_output = annotation_params_for_line("vline", args, "right"); result = codeflash_output

def test_hline_top_left():
    # hline, top left
    args = {"x0": 1, "x1": 10, "y0": 3, "y1": 3}
    codeflash_output = annotation_params_for_line("hline", args, "top left"); result = codeflash_output

def test_hline_top_right():
    # hline, top right
    args = {"x0": 2, "x1": 8, "y0": 4, "y1": 4}
    codeflash_output = annotation_params_for_line("hline", args, "top right"); result = codeflash_output

def test_hline_top():
    # hline, top
    args = {"x0": 3, "x1": 9, "y0": 5, "y1": 5}
    codeflash_output = annotation_params_for_line("hline", args, "top"); result = codeflash_output

def test_hline_bottom_left():
    # hline, bottom left
    args = {"x0": 4, "x1": 12, "y0": 6, "y1": 6}
    codeflash_output = annotation_params_for_line("hline", args, "bottom left"); result = codeflash_output

def test_hline_bottom_right():
    # hline, bottom right
    args = {"x0": 5, "x1": 13, "y0": 7, "y1": 7}
    codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result = codeflash_output

def test_hline_bottom():
    # hline, bottom
    args = {"x0": 6, "x1": 14, "y0": 8, "y1": 8}
    codeflash_output = annotation_params_for_line("hline", args, "bottom"); result = codeflash_output

def test_hline_left():
    # hline, left
    args = {"x0": 7, "x1": 15, "y0": 9, "y1": 9}
    codeflash_output = annotation_params_for_line("hline", args, "left"); result = codeflash_output

def test_hline_right():
    # hline, right
    args = {"x0": 8, "x1": 16, "y0": 10, "y1": 10}
    codeflash_output = annotation_params_for_line("hline", args, "right"); result = codeflash_output

# 2. EDGE TEST CASES

def test_vline_negative_coords():
    # vline with negative coordinates
    args = {"x0": -5, "x1": -5, "y0": -10, "y1": -1}
    codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_hline_negative_coords():
    # hline with negative coordinates
    args = {"x0": -10, "x1": -1, "y0": -5, "y1": -5}
    codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result = codeflash_output

def test_vline_zero_length():
    # vline with zero length (x0 == x1, y0 == y1)
    args = {"x0": 0, "x1": 0, "y0": 0, "y1": 0}
    codeflash_output = annotation_params_for_line("vline", args, "top right"); result = codeflash_output

def test_hline_zero_length():
    # hline with zero length (x0 == x1, y0 == y1)
    args = {"x0": 0, "x1": 0, "y0": 0, "y1": 0}
    codeflash_output = annotation_params_for_line("hline", args, "bottom"); result = codeflash_output

def test_vline_non_integer_coords():
    # vline with float coordinates
    args = {"x0": 1.5, "x1": 1.5, "y0": 2.5, "y1": 7.5}
    codeflash_output = annotation_params_for_line("vline", args, "bottom"); result = codeflash_output

def test_hline_non_integer_coords():
    # hline with float coordinates
    args = {"x0": 1.2, "x1": 4.8, "y0": 3.3, "y1": 3.3}
    codeflash_output = annotation_params_for_line("hline", args, "top"); result = codeflash_output

def test_vline_swapped_y_coords():
    # vline where y0 > y1
    args = {"x0": 5, "x1": 5, "y0": 10, "y1": 2}
    codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_hline_swapped_x_coords():
    # hline where x0 > x1
    args = {"x0": 10, "x1": 2, "y0": 5, "y1": 5}
    codeflash_output = annotation_params_for_line("hline", args, "top right"); result = codeflash_output

def test_vline_none_position_defaults():
    # vline, None as position should default to "top right"
    args = {"x0": 6, "x1": 6, "y0": 1, "y1": 2}
    codeflash_output = annotation_params_for_line("vline", args, None); result = codeflash_output

def test_hline_none_position_defaults():
    # hline, None as position should default to "top right"
    args = {"x0": 3, "x1": 7, "y0": 8, "y1": 8}
    codeflash_output = annotation_params_for_line("hline", args, None); result = codeflash_output

def test_vline_invalid_position_raises():
    # vline, invalid position string
    args = {"x0": 1, "x1": 1, "y0": 0, "y1": 10}
    with pytest.raises(ValueError):
        annotation_params_for_line("vline", args, "foobar")

def test_hline_invalid_position_raises():
    # hline, invalid position string
    args = {"x0": 1, "x1": 10, "y0": 3, "y1": 3}
    with pytest.raises(ValueError):
        annotation_params_for_line("hline", args, "invalid position")

def test_invalid_shape_type_raises():
    # shape_type not vline or hline
    args = {"x0": 1, "x1": 10, "y0": 3, "y1": 3}
    with pytest.raises(ValueError):
        annotation_params_for_line("notaline", args, "top left")

def test_vline_position_order_irrelevant():
    # position order should not matter
    args = {"x0": 1, "x1": 1, "y0": 0, "y1": 10}
    codeflash_output = annotation_params_for_line("vline", args, "top left"); result1 = codeflash_output
    codeflash_output = annotation_params_for_line("vline", args, "left top"); result2 = codeflash_output

def test_hline_position_order_irrelevant():
    # position order should not matter
    args = {"x0": 1, "x1": 10, "y0": 3, "y1": 3}
    codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result1 = codeflash_output
    codeflash_output = annotation_params_for_line("hline", args, "right bottom"); result2 = codeflash_output

def test_vline_large_values():
    # vline with very large values
    args = {"x0": 1e12, "x1": 1e12, "y0": 1e11, "y1": 1e13}
    codeflash_output = annotation_params_for_line("vline", args, "top"); result = codeflash_output

def test_hline_large_values():
    # hline with very large values
    args = {"x0": 1e11, "x1": 1e13, "y0": 1e12, "y1": 1e12}
    codeflash_output = annotation_params_for_line("hline", args, "bottom"); result = codeflash_output

# 3. LARGE SCALE TEST CASES

def test_vline_many_calls():
    # Call the function many times with varying coordinates to check determinism and performance
    for i in range(100):
        args = {"x0": i, "x1": i, "y0": i, "y1": i+10}
        codeflash_output = annotation_params_for_line("vline", args, "top left"); result = codeflash_output

def test_hline_many_calls():
    # Call the function many times with varying coordinates to check determinism and performance
    for i in range(100):
        args = {"x0": i, "x1": i+10, "y0": i, "y1": i}
        codeflash_output = annotation_params_for_line("hline", args, "bottom right"); result = codeflash_output

def test_vline_randomized_positions():
    # Test all valid positions for vline in a loop
    positions = [
        "top left", "top right", "top",
        "bottom left", "bottom right", "bottom",
        "left", "right"
    ]
    args = {"x0": 1, "x1": 1, "y0": 2, "y1": 8}
    expected = [
        dict(xanchor="right", yanchor="top", x=1, y=8, showarrow=False),
        dict(xanchor="left", yanchor="top", x=1, y=8, showarrow=False),
        dict(xanchor="center", yanchor="bottom", x=1, y=8, showarrow=False),
        dict(xanchor="right", yanchor="bottom", x=1, y=2, showarrow=False),
        dict(xanchor="left", yanchor="bottom", x=1, y=2, showarrow=False),
        dict(xanchor="center", yanchor="top", x=1, y=2, showarrow=False),
        dict(xanchor="right", yanchor="middle", x=1.0, y=5.0, showarrow=False),
        dict(xanchor="left", yanchor="middle", x=1.0, y=5.0, showarrow=False),
    ]
    for pos, exp in zip(positions, expected):
        codeflash_output = annotation_params_for_line("vline", args, pos)

def test_hline_randomized_positions():
    # Test all valid positions for hline in a loop
    positions = [
        "top left", "top right", "top",
        "bottom left", "bottom right", "bottom",
        "left", "right"
    ]
    args = {"x0": 2, "x1": 8, "y0": 5, "y1": 5}
    expected = [
        dict(xanchor="left", yanchor="bottom", x=2, y=5, showarrow=False),
        dict(xanchor="right", yanchor="bottom", x=8, y=5, showarrow=False),
        dict(xanchor="center", yanchor="bottom", x=5.0, y=5.0, showarrow=False),
        dict(xanchor="left", yanchor="top", x=2, y=5, showarrow=False),
        dict(xanchor="right", yanchor="top", x=8, y=5, showarrow=False),
        dict(xanchor="center", yanchor="top", x=5.0, y=5.0, showarrow=False),
        dict(xanchor="right", yanchor="middle", x=2, y=5, showarrow=False),
        dict(xanchor="left", yanchor="middle", x=8, y=5, showarrow=False),
    ]
    for pos, exp in zip(positions, expected):
        codeflash_output = annotation_params_for_line("hline", args, pos)

def test_vline_performance_large_numbers():
    # vline with very large numbers, repeated calls
    for i in range(100):
        base = 1e9 + i
        args = {"x0": base, "x1": base, "y0": base, "y1": base+100}
        codeflash_output = annotation_params_for_line("vline", args, "top right"); result = codeflash_output

def test_hline_performance_large_numbers():
    # hline with very large numbers, repeated calls
    for i in range(100):
        base = 1e9 + i
        args = {"x0": base, "x1": base+100, "y0": base, "y1": base}
        codeflash_output = annotation_params_for_line("hline", args, "bottom left"); result = codeflash_output
# codeflash_output is used to check that the output of the original code is the same as that of the optimized code.

To edit these changes git checkout codeflash/optimize-annotation_params_for_line-mb2cqsy6 and push.

Codeflash

Here is the optimized version of your Python program. The major performance bottlenecks are in the `_mean`, `_argmin`, `_argmax`, and `_prepare_position` functions, as indicated by the line profiler results, and in the repeated building and scanning of sets in `annotation_params_for_line`. 

Key optimizations.

- **_mean**: Avoids double computation of `len(x)` and `sum(x)`.  
- **_argmin/_argmax**: Avoids `sorted` and uses a fast linear scan.
- **_prepare_position**: Use tuple for position keys and memoize set/tuple results for the most common positions to avoid repeated `.split()` and `set()` overhead.
- **annotation_params_for_line**: Precompute all values in a single pass, avoid repeated calls to helper functions, and speed up positional checks using sets and tuple lookups.
- **Constants outside the hot loop**.

All function signatures and return values are preserved. All comments are preserved except where the code is directly impacted.



**Summary of optimizations:**
- Median, argmin, and argmax are inlined and linear, not sorted or repeated.
- String splits and set conversions for common positions are cached/memoized.
- All precomputable values are computed once, with special-case optimization for length-2 lists.
- Fast lookup tables and lambda functions for annotation return logic.
- Redundant/minor computations are removed.

This rework will significantly reduce the time spent per call, especially in tight event loops or repeated annotation applications.
@codeflash-ai codeflash-ai bot added the ⚡️ codeflash Optimization PR opened by Codeflash AI label May 24, 2025
@codeflash-ai codeflash-ai bot requested a review from misrasaurabh1 May 24, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡️ codeflash Optimization PR opened by Codeflash AI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant