Fossil

Check-in [6e62c851]
Login

Check-in [6e62c851]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Cache get_comment_format() result to avoid that the global config db is queried once per timeline row, which brings fossil to a standstill when ~/ is NFS-mounted. Discussion in 9aaefe4e536e01bf.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6e62c8510fd61716190926595bd985042dfa4bd39a014fa8e3c414b6ab482059
User & Date: stephan 2022-10-18 16:55:31
Original User & Date: drh 2022-10-18 16:55:31
Context
2022-10-18
17:01
Minor comment reformatting. ... (check-in: 0df4abc7 user: stephan tags: trunk)
16:55
Cache get_comment_format() result to avoid that the global config db is queried once per timeline row, which brings fossil to a standstill when ~/ is NFS-mounted. Discussion in 9aaefe4e536e01bf. ... (check-in: 6e62c851 user: stephan tags: trunk)
16:17
Add a by-hour-of-day report to the /reports page, prompted by a /chat discussion. (Edit: initial user mis-attribution was caused by a config-pull which changed my local default user.) ... (check-in: bb6f2331 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/comformat.c.

511
512
513
514
515
516
517







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
**    1. The global --comfmtflags (alias --comment-format) command-line option.
**    2. The local (per-repository) "comment-format" setting.
**    3. The global (all-repositories) "comment-format" setting.
**    4. The default value COMMENT_PRINT_DEFAULT.
*/
int get_comment_format(){
  int comFmtFlags;







  /* The global command-line option is present, or the value has been cached. */
  if( g.comFmtFlags!=COMMENT_PRINT_UNSET ){
    comFmtFlags = g.comFmtFlags;
    return comFmtFlags;
  }
  /* Load the local (per-repository) or global (all-repositories) value, and use
  ** g.comFmtFlags as a cache. */
  comFmtFlags = db_get_int("comment-format", COMMENT_PRINT_UNSET);
  if( comFmtFlags!=COMMENT_PRINT_UNSET ){
    g.comFmtFlags = comFmtFlags;
    return comFmtFlags;
  }
  /* Fallback to the default value. */
  comFmtFlags = COMMENT_PRINT_DEFAULT;
  return comFmtFlags;
}

/*
**
** COMMAND: test-comment-format
**
** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT?







>
>
>
>
>
>
>


|
<









|
|







511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527

528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
**    1. The global --comfmtflags (alias --comment-format) command-line option.
**    2. The local (per-repository) "comment-format" setting.
**    3. The global (all-repositories) "comment-format" setting.
**    4. The default value COMMENT_PRINT_DEFAULT.
*/
int get_comment_format(){
  int comFmtFlags;

  /* We must cache this result, else
  ** running the timeline can end up querying the comment-format
  ** setting from the global db once per timeline entry, which brings
  ** it to a crawl if that db is network-mounted. Discussed in:
  ** https://fossil-scm.org/forum/forumpost/9aaefe4e536e01bf */

  /* The global command-line option is present, or the value has been cached. */
  if( g.comFmtFlags!=COMMENT_PRINT_UNSET ){
    return g.comFmtFlags;

  }
  /* Load the local (per-repository) or global (all-repositories) value, and use
  ** g.comFmtFlags as a cache. */
  comFmtFlags = db_get_int("comment-format", COMMENT_PRINT_UNSET);
  if( comFmtFlags!=COMMENT_PRINT_UNSET ){
    g.comFmtFlags = comFmtFlags;
    return comFmtFlags;
  }
  /* Fallback to the default value. */
  g.comFmtFlags = COMMENT_PRINT_DEFAULT;
  return g.comFmtFlags;
}

/*
**
** COMMAND: test-comment-format
**
** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT?