From 72de3ecaa78979372dc1bf6741937f91924d2aa9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 17 May 2025 13:07:02 +0200 Subject: [PATCH] Add web cache. --- profiler/src/profiler/TracyLlm.cpp | 4 ++++ profiler/src/profiler/TracyLlm.hpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index bbb81977..d043aaa9 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -852,6 +852,9 @@ static size_t WriteFn( void* _data, size_t size, size_t num, void* ptr ) std::string TracyLlm::FetchWebPage( const std::string& url ) { + auto it = m_webCache.find( url ); + if( it != m_webCache.end() ) return it->second; + static bool initialized = false; if( !initialized ) { @@ -884,6 +887,7 @@ std::string TracyLlm::FetchWebPage( const std::string& url ) { response = std::move( buf ); } + m_webCache.emplace( url, response ); curl_easy_cleanup( curl ); return response; diff --git a/profiler/src/profiler/TracyLlm.hpp b/profiler/src/profiler/TracyLlm.hpp index 212f3d13..179e07ec 100644 --- a/profiler/src/profiler/TracyLlm.hpp +++ b/profiler/src/profiler/TracyLlm.hpp @@ -128,6 +128,8 @@ private: std::unique_ptr m_chat; unordered_flat_map m_chatCache; + unordered_flat_map m_webCache; + ImFont* m_font; ImFont* m_smallFont; ImFont* m_bigFont;