Quick answer: Unity AssetDatabase.FindAssets taking seconds in projects with 10k+ assets? Scans the whole asset graph each call - cache results or use a custom index.
Editor tool walks all materials via FindAssets; 3s lag per refresh.
Cache results
Per-session cache; invalidate on asset import events. Subsequent calls are cheap.
Or build a custom index
AssetPostprocessor maintains a dictionary; lookup is O(1).
Profile FindAssets calls
Each call's cost visible in profiler. Hotspots = candidates for caching.
“FindAssets is convenient and slow. Caching is the cure.”
For editor tools that run frequently, the index pattern is mandatory. Build once; reuse.