Artist Map perf overlay: also POST timings to app.log (readable server-side)
The on-canvas overlay text can't be copied (and can't be grabbed mid-freeze), so
when perf mode is on ('d'), the frontend now also POSTs the render timings to
/api/discover/artist-map/perf ~1.5x/sec, which logs them as [ARTMAP-PERF] in
app.log. Lets the bottleneck be diagnosed from the server side with no manual
copying.
This commit is contained in:
parent
77d6d49069
commit
884c3b5c07
2 changed files with 33 additions and 0 deletions
|
|
@ -28284,6 +28284,19 @@ def get_artist_map_explore():
|
||||||
return _artists_map_get_artist_map_explore()
|
return _artists_map_get_artist_map_explore()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/api/discover/artist-map/perf', methods=['POST'])
|
||||||
|
def log_artist_map_perf():
|
||||||
|
"""Debug sink: the artist-map frontend POSTs its render timings here (toggled
|
||||||
|
with 'd' on the map) so they land in app.log — the on-canvas overlay text
|
||||||
|
can't be copied. Used to find the real drag/zoom bottleneck."""
|
||||||
|
try:
|
||||||
|
data = request.get_json(silent=True) or {}
|
||||||
|
logger.info("[ARTMAP-PERF] %s", json.dumps(data, ensure_ascii=False))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return ('', 204)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/discover/build-playlist/search-artists', methods=['GET'])
|
@app.route('/api/discover/build-playlist/search-artists', methods=['GET'])
|
||||||
def search_artists_for_playlist():
|
def search_artists_for_playlist():
|
||||||
"""Search for artists to use as seeds for custom playlist building"""
|
"""Search for artists to use as seeds for custom playlist building"""
|
||||||
|
|
|
||||||
|
|
@ -5720,6 +5720,26 @@ function _artMapDrawPerf(ctx, t0) {
|
||||||
_artMap._lastPerfTs = now;
|
_artMap._lastPerfTs = now;
|
||||||
const fps = dt > 0 ? Math.round(1000 / dt) : 0;
|
const fps = dt > 0 ? Math.round(1000 / dt) : 0;
|
||||||
const oc = _artMap.offscreen;
|
const oc = _artMap.offscreen;
|
||||||
|
|
||||||
|
// Ship the numbers to app.log (~1.5/s) so they can be read server-side —
|
||||||
|
// the on-canvas text below can't be copied, especially mid-lag.
|
||||||
|
if (!_artMap._perfPostTs || now - _artMap._perfPostTs > 700) {
|
||||||
|
_artMap._perfPostTs = now;
|
||||||
|
try {
|
||||||
|
fetch('/api/discover/artist-map/perf', {
|
||||||
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
nodes: _artMap.placed.length, edges: (_artMap.edges || []).length,
|
||||||
|
buffer: oc ? oc.width + 'x' + oc.height : '-',
|
||||||
|
scale: +(_artMap._bufferScale || 0).toFixed(3),
|
||||||
|
zoom: +_artMap.zoom.toFixed(3),
|
||||||
|
rebuildMs: +(_artMap._rebuildMs || 0).toFixed(1),
|
||||||
|
drawMs: +drawMs.toFixed(1), fps,
|
||||||
|
}),
|
||||||
|
}).catch(() => { });
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
|
}
|
||||||
|
|
||||||
const lines = [
|
const lines = [
|
||||||
`nodes ${_artMap.placed.length} edges ${(_artMap.edges || []).length}`,
|
`nodes ${_artMap.placed.length} edges ${(_artMap.edges || []).length}`,
|
||||||
`buffer ${oc ? oc.width + '×' + oc.height : '—'} scale ${(_artMap._bufferScale || 0).toFixed(3)}`,
|
`buffer ${oc ? oc.width + '×' + oc.height : '—'} scale ${(_artMap._bufferScale || 0).toFixed(3)}`,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue