logging: bypass timestamp formatting when not logging #12970

pull theuni wants to merge 1 commits into bitcoin:master from theuni:slow-tests changing 1 files +9 −7
  1. theuni commented at 9:26 pm on April 12, 2018: member

    As suggested by @laanwj on IRC:

    0<cfields> whoa
    1<cfields> Leaving test case "knapsack_solver_test"; testing time: 358694ms
    2<cfields> i386 + old wine ^^
    3<cfields> Leaving test case "knapsack_solver_test"; testing time: 6781ms
    4<cfields> ^^ same, but with the LogPrint commented out
    5...
    6<wumpus> if both log-to-file and log-to-console is disabled, it should probably bypass all logging
    

    Edit: The painful line commented out being the LogPrintf in CWallet::AddToWallet.

  2. MarcoFalke added the label Refactoring on Apr 12, 2018
  3. laanwj commented at 9:35 pm on April 12, 2018: member
    utACK 8ca1f6ecba5efc278927fd34eb04f6a4254dfe03
  4. theuni commented at 9:41 pm on April 12, 2018: member
    Wine i686 build down to 11 min :)
  5. MarcoFalke commented at 9:41 pm on April 12, 2018: member
    utACK 8ca1f6e (Run time seems to be about the same or slightly faster than with the wine-hq)
  6. theuni commented at 10:14 pm on April 12, 2018: member
    While this is an easy win for tests, we should still track down why LogTimestampStr() is so painful.
  7. laanwj commented at 10:23 pm on April 12, 2018: member

    While this is an easy win for tests, we should still track down why LogTimestampStr() is so painful.

    It looks inefficient too:

    0std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
    1{
    2    static std::locale classic(std::locale::classic());
    3    // std::locale takes ownership of the pointer
    4    std::locale loc(classic, new boost::posix_time::time_facet(pszFormat));
    5    std::stringstream ss;
    6    ss.imbue(loc);
    7    ss << boost::posix_time::from_time_t(nTime);
    8    return ss.str();
    9}
    
  8. in src/util.cpp:342 in 8ca1f6ecba outdated
    338@@ -339,6 +339,10 @@ int LogPrintStr(const std::string &str)
    339     int ret = 0; // Returns total number of characters written
    340     static std::atomic_bool fStartedNewLine(true);
    341 
    342+    if (!fPrintToConsole && !fPrintToDebugLog) {
    


    laanwj commented at 10:25 pm on April 12, 2018:
    nit: might be even more efficient to do this check in util.h already, before calling tfm::format.

    theuni commented at 10:34 pm on April 12, 2018:
    Good point, done.
  9. theuni force-pushed on Apr 12, 2018
  10. logging: bypass timestamp formatting when not logging
    This leads to massive speedups under Wine.
    339730a6d8
  11. theuni force-pushed on Apr 12, 2018
  12. jimpo commented at 1:18 am on April 13, 2018: contributor
    utACK 339730a
  13. sipa commented at 1:27 am on April 13, 2018: member
    utACK 339730a6d84a3a90ae23d732fbfc1c81af88d435
  14. fanquake commented at 1:30 am on April 13, 2018: member
    utACK 339730a
  15. sipa merged this on Apr 13, 2018
  16. sipa closed this on Apr 13, 2018

  17. sipa referenced this in commit 5df84de583 on Apr 13, 2018
  18. practicalswift commented at 5:18 am on April 13, 2018: contributor

    utACK 339730a6d84a3a90ae23d732fbfc1c81af88d435

    Impressive! Very nice find!

  19. laanwj referenced this in commit dec61152d6 on Apr 14, 2018
  20. MarcoFalke referenced this in commit 7b18489ce0 on Apr 20, 2018
  21. MarcoFalke referenced this in commit ae3970655e on May 24, 2018
  22. MarcoFalke referenced this in commit 2d27e63426 on May 24, 2018
  23. MarcoFalke referenced this in commit b3cf3ad30a on May 29, 2018
  24. PastaPastaPasta referenced this in commit c399d41af4 on Jun 17, 2020
  25. PastaPastaPasta referenced this in commit 09f21b73f6 on Jun 17, 2020
  26. PastaPastaPasta referenced this in commit 0524dfb93d on Jun 27, 2020
  27. PastaPastaPasta referenced this in commit e1967e42c4 on Apr 13, 2021
  28. PastaPastaPasta referenced this in commit 9b11b3d8ef on Apr 17, 2021
  29. PastaPastaPasta referenced this in commit bb1ae8452c on Apr 18, 2021
  30. kittywhiskers referenced this in commit 318281c506 on Apr 23, 2021
  31. gades referenced this in commit 809cfd0267 on Jun 30, 2021
  32. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me