From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Which Elisp data structure is fastest for searching? Date: Wed, 25 Dec 2024 12:33:08 +0300 Message-ID: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37783"; mail-complaints-to="usenet@ciao.gmane.io" To: Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 25 10:34:23 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tQNmZ-0009kY-4f for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 25 Dec 2024 10:34:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQNm1-00058Y-7z; Wed, 25 Dec 2024 04:33:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQNly-00058P-O2 for help-gnu-emacs@gnu.org; Wed, 25 Dec 2024 04:33:47 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQNlx-0003G2-AO for help-gnu-emacs@gnu.org; Wed, 25 Dec 2024 04:33:46 -0500 Original-Received: from localhost ([::ffff:41.75.177.228]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000007DC20.00000000676BD156.0011A131; Wed, 25 Dec 2024 02:33:10 -0700 Received-SPF: pass client-ip=217.170.207.13; envelope-from=support1@rcdrun.com; helo=stw1.rcdrun.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.156, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148966 Archived-At: It says in Emacs Lisp manual: * Hash Tables:: Very fast lookup-tables. (info "(elisp) Hash Tables") 8 Hash Tables ************* A hash table is a very fast kind of lookup table, somewhat like an alist (*note Association Lists::) in that it maps keys to corresponding values. The above is not so conclusive and I have not done measurements. It says "somewhat like an alist", but is the alist faster in searching through elements or the hash table? I wish to make website search, something I always had before on websites, though at the time I was using Perl and shell tools. Now I am using Emacs Lisp for website applications. Each piece of information in the data structure such as plist, alist, hash, will have: - title - URL - description - summary plain text which is shorter than the actual text I will search all of the pieces of information. With alist that may be easier. With hash, I would need to structure the `value' part again into four different things, not so? What would be better decision? Jean Louis