You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/05/18 17:04:34 UTC

[GitHub] [trafficserver] bryancall commented on pull request #8855: Allow for long Http* error.log lines

bryancall commented on PR #8855:
URL: https://github.com/apache/trafficserver/pull/8855#issuecomment-1130265617

   Here is a benchmark I wrote testing thread_local strings vs locally scoped.  Personally I don't think it is worth saving less than 1 microsecond for error messages to have thread_local.
   
   Benchmark results:
   ```
   ----------------------------------------------------------------------------
   Benchmark                                  Time             CPU   Iterations
   ----------------------------------------------------------------------------
   thread_local_benchmark/threads:12        139 ns         1496 ns       538452
   local_scope_benchmark/threads:12        6.68 ns         80.0 ns      8045064
   ```
   
   
   Code:
   ```
   #include <benchmark/benchmark.h>
   #include <thread>
   
   //----------------------------------------------------------------------------
   static void thread_local_benchmark(benchmark::State& state) {
     for (auto _ : state) {
       thread_local std::string str;
       str.append("dlk alsdkfjsaldkfj alskdfjasldk alskdfjlasdk ldsasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfj");
       str.append("jfghkjirtyu fj alskdfjasldk alskdfjladk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfjdlk alsdkfjsaldkasdfasdfasd asdfasddf asdfasdf asdfasdf asdfasdfasdf afghjfghk alskdfjlasdk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfjdlk alsdkfjsaldkasdfasdfasd asdfasddf asdfasdf asdfasdf asdfasdfasdf afghjfghkjirtyu fj alskdfjasldk alskdfjlasdk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfjdfasd asdfasddf asdfas fj alskdfjasllasdk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfj");
     }
   }
   
   //----------------------------------------------------------------------------
   static void local_scope_benchmark(benchmark::State& state) {
     for (auto _ : state) {
       std::string str;
       str.append("dlk alsdkfjsaldkfj alskdfjasldk alskdfjlasdk ldsasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfj");
       str.append("jfghkjirtyu fj alskdfjasldk alskdfjladk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfjdlk alsdkfjsaldkasdfasdfasd asdfasddf asdfasdf asdfasdf asdfasdfasdf afghjfghk alskdfjlasdk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfjdlk alsdkfjsaldkasdfasdfasd asdfasddf asdfasdf asdfasdf asdfasdfasdf afghjfghkjirtyu fj alskdfjasldk alskdfjlasdk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfjdfasd asdfasddf asdfas fj alskdfjasllasdk lasdkfjalsdkfj lkj falskdjfla sdjfjlsjdfl alsdjkflsfj");
     }
   }
   
   
   BENCHMARK(thread_local_benchmark)->Threads(12);
   BENCHMARK(local_scope_benchmark)->Threads(12);
   BENCHMARK_MAIN();
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org