diff --git a/web_server.py b/web_server.py index 0e8c0d68..13eb3368 100644 --- a/web_server.py +++ b/web_server.py @@ -28284,6 +28284,19 @@ def 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']) def search_artists_for_playlist(): """Search for artists to use as seeds for custom playlist building""" diff --git a/webui/static/discover.js b/webui/static/discover.js index 6e3230b3..ab244807 100644 --- a/webui/static/discover.js +++ b/webui/static/discover.js @@ -5720,6 +5720,26 @@ function _artMapDrawPerf(ctx, t0) { _artMap._lastPerfTs = now; const fps = dt > 0 ? Math.round(1000 / dt) : 0; 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 = [ `nodes ${_artMap.placed.length} edges ${(_artMap.edges || []).length}`, `buffer ${oc ? oc.width + '×' + oc.height : '—'} scale ${(_artMap._bufferScale || 0).toFixed(3)}`,