MCPcopy Create free account
hub / github.com/FastLED/FastLED / get_top_operations

Method get_top_operations

ci/perf/compile_perf.py:258–288  ·  view source on GitHub ↗

Get top N slowest operations. Returns: List of (operation_type, detail, time_ms) e.g., ('ParseClass', 'fl::string', 129.4)

(self, n: int = 20)

Source from the content-addressed store, hash-verified

256 return sorted(fastled_headers, key=lambda x: x[1], reverse=True)
257
258 def get_top_operations(self, n: int = 20) -> list[tuple[str, str, float]]:
259 """
260 Get top N slowest operations.
261
262 Returns:
263 List of (operation_type, detail, time_ms)
264 e.g., ('ParseClass', 'fl::string', 129.4)
265 """
266 operations: list[tuple[str, str, float]] = []
267
268 for event in self.events:
269 name = event.get("name", "")
270 dur = event.get("dur", 0)
271 detail = event.get("args", {}).get("detail", "")
272
273 # Skip very short operations
274 if dur < 1000: # Less than 1ms
275 continue
276
277 # Include interesting operations
278 if any(
279 keyword in name
280 for keyword in ["Parse", "Instantiate", "Source", "Template"]
281 ):
282 if name == "Source":
283 detail = self._extract_header_name(detail)
284 operations.append((name, detail, dur / 1000.0))
285
286 # Sort by time and return top N
287 operations.sort(key=lambda x: x[2], reverse=True)
288 return operations[:n]
289
290 def build_header_tree(self, max_depth: int = 3) -> dict[str, Any]:
291 """Build nested tree of header includes up to max_depth levels deep."""

Callers 2

generate_reportMethod · 0.95
generate_jsonMethod · 0.95

Calls 5

_extract_header_nameMethod · 0.95
anyFunction · 0.85
sortMethod · 0.80
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected