all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Joel Reicher <joel.reicher@gmail.com>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Which Elisp data structure is fastest for searching?
Date: Fri, 27 Dec 2024 14:16:14 +0300	[thread overview]
Message-ID: <Z26MftXgeERDY25b@lco2> (raw)
In-Reply-To: <86bjwycahu.fsf@gmail.com>

* Joel Reicher <joel.reicher@gmail.com> [2024-12-27 02:06]:
> Jean Louis <bugs@gnu.support> writes:
> 
> [...]
> 
> > As is written in manual that hash table is very fast, I believe yes,
> > though my search may not be.
> > 
> > I will use following approach:
> > 
> > - there will be list or hash with values that are to be searched,
> > those values will have their ID, that information will be   prepared for
> > easier searching, like special symbols removed,   only words remaining,
> > maybe even small words could be removed
> 
> This makes me think you don't yet know what your equality predicate is, and
> whether your search space is totally or partially ordered, or
> unordered.

No, I have no idea to what equality predicate refers. You see, for
searching it is better to remove new lines, and multiple spaces,
emoji, symbols, any of characters that are not letters and numbers. So
the search over such strings is easier to accomplish.

Each string will have its ID.

By using ID I can then find name, URL, description within the hash
table.

And actually, all of the information can be stored in the single hash.

id-string -- contains "93206|We strive to bring customers"

So searching would be inside of id-string keys.

id-string contains id.

then once found, I can extract other keys: id-name, it-title,
id-description to show it as list of links.

> I don't think you will be able to choose a data structure until you have
> these things figured out.

Yes, but I am on the verge. I have already list, alist and hash and I
think hash is still easiest to do for reason of how to choose those
keys.

> > - there will be different hash with accurate information about the ID,
> > such as title, URL, description
> 
> I am not sure you are using the word "hash" the same way "hash table" does,
> but if I'm right about the above, it doesn't matter, because you must figure
> those things out first.

Like this:

| Key            | Value                               |
|----------------+-------------------------------------|
| id-string      | "123|name link description summary" |
| id-name        | "name"                              |
| id-link        | "url"                               |
| id-description | "description"                       |

That means all the search will be through values, and only keys named
"-string".

Once found, ID is taken from string, and then remaining values
displayed.

> > That is approach I know. Then I can give relevant information for
> > website search.
> > 
> > I wonder if Emacs can remain in memory keeping to answer HTTP requests,
> > so that I do not load it every time.
> 
> Yes it can, but I think worrying about that now is a bit like worrying about
> how long to age the cheese when you haven't even milked the cow.

Hahahahhaha

-- 
Jean Louis



  reply	other threads:[~2024-12-27 11:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-25  9:33 Which Elisp data structure is fastest for searching? Jean Louis
2024-12-26  6:24 ` Joel Reicher
2024-12-26  8:53   ` Jean Louis
2024-12-26  9:23     ` tomas
2024-12-26 11:49       ` Jean Louis
2024-12-26 23:03     ` Joel Reicher
2024-12-27 11:16       ` Jean Louis [this message]
2024-12-28  3:32         ` Joel Reicher

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

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

  git send-email \
    --in-reply-to=Z26MftXgeERDY25b@lco2 \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=joel.reicher@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.