From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Emacs needs truely useful flex matching Date: Sun, 14 Apr 2013 14:18:09 -0400 Message-ID: References: <877gl0od6x.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365963495 25410 80.91.229.3 (14 Apr 2013 18:18:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Apr 2013 18:18:15 +0000 (UTC) Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , emacs-devel@gnu.org To: Le Wang Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 14 20:18:19 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1URRVJ-0004d2-18 for ged-emacs-devel@m.gmane.org; Sun, 14 Apr 2013 20:18:17 +0200 Original-Received: from localhost ([::1]:45591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URRVI-0002z4-Jv for ged-emacs-devel@m.gmane.org; Sun, 14 Apr 2013 14:18:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URRVD-0002yR-Ir for emacs-devel@gnu.org; Sun, 14 Apr 2013 14:18:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URRVC-0002y8-Mv for emacs-devel@gnu.org; Sun, 14 Apr 2013 14:18:11 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:16611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URRVC-0002xz-I9 for emacs-devel@gnu.org; Sun, 14 Apr 2013 14:18:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxIEd/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFFxIEd/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="7389713" Original-Received: from 69-196-129-29.dsl.teksavvy.com (HELO pastel.home) ([69.196.129.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Apr 2013 14:18:06 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 2D77D67923; Sun, 14 Apr 2013 14:18:09 -0400 (EDT) In-Reply-To: (Le Wang's message of "Mon, 15 Apr 2013 00:48:21 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158906 Archived-At: >> "\\(\\<\\)?a\\([^b]*\\)\\(\\<\\)?b\\([^c]*\\)\\(\\<\\)?c\\([^d]*\\)\\(\\<\\)?d" >> > the regexp matching should be fairly efficient and you should be able to >> > compute the score efficiently as well (at least if >> > you ignore the camelCase boundaries). >> I hadn't thought of this, and I'll try it soon. > I gave this a good try. :-) > Since we are favouring beginning of word anchors (often but not always), I > actually had to insert "\\<" in the various slots in front of characters. > That is all permutations of 4x"\\<", then 3x, then 2x, then 1x, etc. I don't understand. The example I gave already has all the "\\<" we need, doesn't it? > The algorithm works fast. I believe it has feature parity with Sublime > Text's fuzzy search. > However it uses a fair bit of memory, > 1. it's allocating one hash table and one same-length vector for each string > 2. it's allocating one cons cell for each character. Sounds great. It does seem to require a fair bit of pre-processing, tho. When you say it's fast, does that include the time it takes to build the hash tables from the list of potential candidates? Stefan