• Ryan Groch's avatar
    perf: change db to WAL mode (#3140) · 55e3ad70
    Ryan Groch 提交于
    This PR changes the SQLite database setting to use WAL (Write-Ahead
    Logging) mode. From what I can tell, it should be an easy performance
    improvement with no real downside for our case. Documentation is here:
    https://sqlite.org/wal.html
    
    Also, the [docs for
    better-sqlite3](https://www.npmjs.com/package/better-sqlite3) explicitly
    recommend it:
    
    > Though not required, it is generally important to set the WAL pragma
    for performance reasons.
    
    I came across this as I was looking into the issue where the chat code
    blocks slow down Dyad's framerate. I'm not entirely sure whether this is
    related, but I did notice that sometimes database calls were taking a
    lot longer than I expected, and that would cause Dyad's framerate to
    drop significantly on my machine. This change seems to be an improvement
    in that regard, so it might also have an effect on the code blocks issue
    as well.
    
    It's hard to accurately benchmark this because its effect is only
    substantial when there are multiple database calls going on at the same
    time. I can definitely attempt a benchmark if that would be worthwhile
    though.
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/3140"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    55e3ad70
index.ts 2.6 KB