MCPcopy Index your code
hub / github.com/plotly/dash / test_compute_graph_timing

Function test_compute_graph_timing

tests/integration/renderer/test_benchmarking.py:109–136  ·  view source on GitHub ↗
(dash_duo, dev_tools, store)

Source from the content-addressed store, hash-verified

107 ],
108)
109def test_compute_graph_timing(dash_duo, dev_tools, store):
110 app = make_app()
111 dash_duo.start_server(app, **dev_tools)
112 times = []
113 for _ in range(10):
114 dash_duo.wait_for_element("#input")
115 wait.until(
116 lambda: dash_duo.find_element("#output").text.strip() != "", timeout=4
117 )
118 graph_compute_time = float(
119 dash_duo.driver.execute_script(
120 "return window.dash_component_api.callbackGraphTime"
121 )
122 )
123 times.append(graph_compute_time)
124 dash_duo.driver.refresh()
125 avg_time = sum(times) / len(times) if times else 0
126 check_timing[store] = avg_time
127 if store == "enabled":
128 print(f"Average time with store enabled: {avg_time:.2f} ms")
129 assert (
130 check_timing["disabled"] < avg_time
131 ), "Expected faster performance with circular callback check disabled"
132 if store == "disabled":
133 print(f"Average time with store disabled: {avg_time:.2f} ms")
134 assert (
135 avg_time < 200
136 ), "Expected average time to be under 100 ms with circular callback check disabled"

Callers

nothing calls this directly

Calls 5

wait_for_elementMethod · 0.80
find_elementMethod · 0.80
make_appFunction · 0.70
start_serverMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…