<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 06/03/17 10:49, Martin Kampas wrote:<br>
    <blockquote
cite="mid:597ECB6BFD23CC488EED8B6CD7566AD23307F688@ORD2MBX01B.mex05.mlsrvr.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style>
      <div style="direction: ltr;font-family: Tahoma;color:
        #000000;font-size: 10pt;">Hi Rinigus,<br>
        <br>
        Did you consider this recommendation?<br>
        <br>
        "To simplify matters, SQLite is also available as a pre-packaged
        amalgamation source code file: sqlite3.c. The amalgamation is a
        single file of ANSI-C code that implements the entire SQLite
        library. The amalgamation is much easier to deal with.
        Everything is contained within a single code file, so it is easy
        to drop into the source tree of a larger C or C++ program.
        [...] 
        <i>For these reasons, the amalgamation source file ("sqlite3.c")
          is recommended for all applications</i>."[1]<br>
        <br>
        What are the reasons that prevent you from using the upstream
        recommended approach? Are they worth your time and effort?<br>
        <br>
      </div>
    </blockquote>
    <br>
    I was always amused by this recommendation. Note that they carefully
    say "it is easy to drop into the source tree of a LARGER C or C++
    program". Even they do understand that it's ridiculous to drop 200k
    lines of obscure code into a poor little program that just happened
    to be in need of some database access.<br>
    <br>
    But yeah, if you have written a few million lines of code, adding
    200k more is not such a big deal. Still, I would personally prefer
    to use the system library for the sake of performance, future
    updates, bug fixes and system-specific tweaks.<br>
    <br>
    Here's a good example - by default sqlite3.c is using up to
    2MB+500KB of memory for some sort of cache, meaning that every app
    that has some use of sqlite would consume at least 2.5MB of heap.
    That code will never deallocate anything until the buffer fills up,
    it's that bad. It was quite noticeable on the heap usage graph. We
    have reduced that to 500KB+125KB and things got better:<br>
    <br>
    <a class="moz-txt-link-freetext" href="https://git.merproject.org/mer-core/sqlite/commit/f132f16b">https://git.merproject.org/mer-core/sqlite/commit/f132f16b</a><br>
    <br>
    However, it obviously doesn't affect the apps which have that
    default 2.5MB limit compiled in. Those will happily continue eating
    up memory.<br>
    <br>
    I would encourage the developers to use the system sqlite library.<br>
    <br>
    Cheers,<br>
    -Slava<br>
  </body>
</html>