unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Qiantan Hong <qhong@mit.edu>
Cc: emacs-devel@gnu.org, Zhu Zihao <all_but_last@163.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Against sqlite3!!!
Date: Tue, 07 Dec 2021 20:34:38 +0100	[thread overview]
Message-ID: <87wnkg5fvo.fsf@gnu.org> (raw)
In-Reply-To: <28E143D2-5C8F-4CDC-B6CE-15F672A00AB1@mit.edu>

Qiantan Hong <qhong@mit.edu> writes:

>> I'm not very knowledgable with cl-* stuff but doesn't your
>> implementation load all key-value pairs at once?  That would be quite
>> a disadvantage compared to a DB approach where I'd naturally expect
>> that only the value I'm asking for is loaded.
> It does, but I’ve done some benchmark and it loads 10k entries in
> 0.02~0.03 seconds. 100k entries takes <0.5s.

But your values are very only small lists.

> I’d say it should be suffice for most Emacs application I know of.
> Nobody is using Emacs for trillions of business records.

I'd imagine that if such a feature became available, packages would
start using it and store more data that they do now for whatever
reasons.  Like eww/elpher could want to store the list of the last 100
visited URLs.

>> Also, how would it ensure consistency when I have 2 parallel emacs
>> sessions (like one for mail/irc and one for programming/editing) where
>> session 1 modifies the value of key A and the other of key B?  It looks
>> like the values of the kv-store that gets saved later will win.  In case
>> that's the emacs session which has modified B, it'll revert A to the
>> state before the other session modified it, no?
>
> Since it records a log of deltas instead of printing the whole data
> structure, different key won’t interfere.

Ah, allright.  By skimming the code I've first thought the log would
only be for analysis/debugging purposes.

> Being said that, currently it probably won’t work because UNIX append
> is not atomic and will probably be interleaved into nonsense.
> There’re various workarounds, lock file being one, but I like the idea
> of keeping only one “controller” instance with exclusive access to the
> file more.

Interesting, but how would emacs instances interact with that controller
instance?  And would that controller instance simply be the first emacs
instance of a user?  What if the controller blocks because Gnus is
running and currently downloading mails with huge attachments?

>> If that were true, I'd say your resist!.el is a non-starter in the
>> current form.  It should at least load only values explicitly asked for
>> and only persist/override actually changed values.  A trivial solution
>> could use one file per key.  Not sure how sensible that is.
> It does the latter.

No, it uses one file per kv-store but you can have as many kv-stores as
you like, e.g., one per package.  Or do you mean "it only overrides
changed values" with "the latter"?  Indeed, that's true.  I've played
with the code and now understand it.  Nice! :-) (kv-rem is missing a
kv-store arg.)

> As I’ve mentioned, from the benchmark results, the former doesn’t
> seem to be a big problem. You’ll do it at most once for every Emacs
> instance anyway.

Yeah, and since it's no global store in the sense of "every package
feeds its data into the same store", my argument is void.  If my emacs
session doesn't start Gnus, Gnus won't load its own store.

Bye,
Tassilo



  parent reply	other threads:[~2021-12-07 19:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <MN2PR12MB3391BC76A0D05236AC76C94E946E9@MN2PR12MB3391.namprd12.prod.outlook.com>
2021-12-07  8:13 ` Against sqlite3!!! (Was: sqlite3) Qiantan Hong
2021-12-07  9:14   ` Qiantan Hong
2021-12-07 12:49   ` Against sqlite3!!! Colin Baxter 😺
2021-12-07 13:21   ` Stefan Monnier
2021-12-07 13:55     ` Qiantan Hong
2021-12-07 15:51       ` Tassilo Horn
2021-12-07 16:35         ` Qiantan Hong
2021-12-07 18:43           ` Arthur Miller
2021-12-07 19:13             ` Qiantan Hong
2021-12-07 19:34           ` Tassilo Horn [this message]
2021-12-08 10:00             ` Yuri Khan
2021-12-07 19:52           ` Stefan Monnier
2021-12-07 13:45   ` Against sqlite3!!! (Was: sqlite3) Zhu Zihao
2021-12-07 14:50     ` Against sqlite3!!! David Engster
2021-12-07 20:00       ` Lars Ingebrigtsen
2021-12-08  6:11         ` Arthur Miller
2021-12-08  6:20           ` Qiantan Hong
2021-12-08  9:21             ` Arthur Miller
2021-12-08  9:28               ` Qiantan Hong
2021-12-09  7:12           ` Alexandre Garreau
2021-12-09  7:27             ` Qiantan Hong
     [not found]               ` <24465971.J1OoJ6LT5i@galex-713.eu>
2021-12-09  7:50                 ` Qiantan Hong
2021-12-09 19:16                   ` Thierry Volpiatto
2021-12-09 19:24                     ` Qiantan Hong
2021-12-09 19:28                     ` Qiantan Hong
2021-12-09 13:17               ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnkg5fvo.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=all_but_last@163.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=qhong@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).