From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: empty-directory predicate, native implementation Date: Sat, 17 Oct 2020 23:02:33 +0200 Message-ID: References: <83y2ka18t7.fsf@gnu.org> <87y2kaj799.fsf@gmx.de> <83blh60wgr.fsf@gnu.org> <87h7qxjh7g.fsf@gmx.de> <878sc8kgy8.fsf@gmx.de> <87imbcls71.fsf@gmx.de> <83eem0zt0b.fsf@gnu.org> <87k0vsrd6m.fsf@gmx.de> <83a6wozs7h.fsf@gnu.org> <87sgafq2e2.fsf@gmx.de> <87h7qvptm3.fsf@gmx.de> <871rhxp8we.fsf@gmx.de> <237bd21b-96c7-4433-a5bc-34b64a9f4250@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20416"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , Michael Albinus , emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 17 23:03:49 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kTtMi-0005Cq-7p for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Oct 2020 23:03:48 +0200 Original-Received: from localhost ([::1]:50322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTtMh-0008P5-8H for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Oct 2020 17:03:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTtLc-0007ZQ-7v for emacs-devel@gnu.org; Sat, 17 Oct 2020 17:02:40 -0400 Original-Received: from mail-vi1eur06olkn2096.outbound.protection.outlook.com ([40.92.17.96]:21953 helo=EUR06-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTtLa-0007p5-0v; Sat, 17 Oct 2020 17:02:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VVD0azWNut6BEv53jhetuHVZZznS3TNN0QbU6KW8OwyyZhaxIlHSDQ9ZkWBZC4tQDnJaIjkvPy3canpUkvpuZPOdUSU16tEEsm9ZD0MLsLtkTicNQgvGqEmVtfFH5tHMPvvbGLEPfH0TKmviKpq/2QL4wAv3Bf47ILVHYsRmYCm2NYwCJIXVpRXSkTirJFEC+Djc/aiieloiUBZmtjYdr9q6InBqDbCWtkiQDwisNf0FTxp4HLst3HBfqHrJPQF6/LOJ2vFi3nH3YYwEQiMf7ahYpu9+QrN+x7zh0Eo9zncqDyoyNHlcz43GYNoFtv7Va72Sr7mirDh5w42ya5b1rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NYdyGZcBNu+poDRW/EmBKvSiDJbQseH+FIQCcEo+G48=; b=moaWaDdEa3Da8Qbsl+myttDrqwXWOkMdGwZWUQV+2h++GOYexYSuYwCWyrNvB5brXfhVSSmL6hNvCJW4IdKn+qbVAs9KQMz4l/tX9uF5zkxYw9mVS78Hs5hsd/D9MPV2+qngk6ZgiN+lNaitcGOLYDgyqxuOcHh8L6ycUXZrVG0fRHggI8o7sloCy87yU+nqSHxiJZcGWKlgijPQlvqBkajOPwC5Nt/MbG9FOAfqpiRujSyx21sRwyII8DuhPvTm21lz1ruNoCZkOSn4U59L4WfmynyEWnnEIELAIgmbaans3gb1CG4ldec5E44oD35VyKf/VDORfrrHmyfeqY/dwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NYdyGZcBNu+poDRW/EmBKvSiDJbQseH+FIQCcEo+G48=; b=AmtPEpyDdyQGZYgYYR9poGxg441wCIAzBlUwjGnO+DIHniomkrKx4vkSnd4eTGr5yjo8hdWwCIFlunxBxvkXABoUrfx4zcKHLWZGAfd2V2A08zdaTfIQlnaFATpFBAswKV0zHYrbiMQNl2kg4W/rlW8ROKAvWvi9IU9u2ZuOG+riwe9zxRM8fuJVsicABbsIoI8BLYCYJHSYKYig6YCO5nuVoDlP39rdZIVZtX+i630mFmJf/Ei526vqckSckrLQLob6730T7fAwsLDBW9i/DNNv5RtfKGZBGEl+1ZbL8y1YYO3dBqSN/hgsyal0mMRLP7n/BdpijulsLogiPlXHWQ== Original-Received: from AM7EUR06FT054.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::43) by AM7EUR06HT148.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::294) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Sat, 17 Oct 2020 21:02:34 +0000 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com (2a01:111:e400:fc36::43) by AM7EUR06FT054.mail.protection.outlook.com (2a01:111:e400:fc36::407) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Sat, 17 Oct 2020 21:02:34 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:6E5FAEC53940DEF672F79AA46BD1FC94DF89C11C50D64D4A01425F8B59EBD61D; UpperCasedChecksum:4DED36E7089A39034797E41E7C99A61C855F90F030CFEA76EDF2B6C3F0230239; SizeAsReceived:8467; Count:46 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::187b:196a:cb2d:adf1]) by VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::187b:196a:cb2d:adf1%5]) with mapi id 15.20.3477.023; Sat, 17 Oct 2020 21:02:34 +0000 In-Reply-To: <237bd21b-96c7-4433-a5bc-34b64a9f4250@default> (Drew Adams's message of "Sat, 17 Oct 2020 13:03:35 -0700 (PDT)") X-TMN: [vtVpX1SC/kSEdVV80Ffn8NotMs8EYaWI] X-ClientProxiedBy: AM6PR10CA0008.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::21) To VI1PR06MB4526.eurprd06.prod.outlook.com (2603:10a6:803:ac::17) X-Microsoft-Original-Message-ID: <87v9f85zx2.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM6PR10CA0008.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Sat, 17 Oct 2020 21:02:34 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f9fd0c2b-908d-4eff-eabf-08d872dff85e X-MS-TrafficTypeDiagnostic: AM7EUR06HT148: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n5sA4IKdk0irdcHfJxDj7oTwjhBKfiLHdytUp4xzvG3MlOmBHvxLAhAG7im9X1Ybk23i2jmhqzrLeczqYGMXasFfQuXdz8K2Ut0n9WGqSsQZwP5p4tPGW4vGZTyOPHBN6ClZW1PMeBkvLIiPC/SQrpw2VnvvGw4Jo5pSj6b8J9JY1eHlRPdp2kP/wd2pkjJ6rBPVciJtPpM03d/QmFiuEA== X-MS-Exchange-AntiSpam-MessageData: OP3AKhT/oj2DSjmrwbdPC/B4Iz16gkxHtHhL+mIPbZRvqLHP1ii2fDIdnfSy7z5hvfBiY2nR/AG20V+VT/wc9xvI+VLj8sE6v7qGYisB5UXPnjV8p6CZWQB6VBb3X8jSBUAL35OAzPqC3EB8t5CDng== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9fd0c2b-908d-4eff-eabf-08d872dff85e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:02:34.6836 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM7EUR06FT054.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7EUR06HT148 Received-SPF: pass client-ip=40.92.17.96; envelope-from=arthur.miller@live.com; helo=EUR06-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/17 17:02:35 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:257971 Archived-At: Drew Adams writes: > Sorry I'm coming to this late. It's a long thread, > and I've only checked your patch, not the messages. > > I don't understand why we would do this. Is the > real aim to be able to have an empty-directory > predicate, i.e., to be able to see if there are > no files in a directory? I would just like to add to the previous mail; that this optimisation really does not matter on very first call. Since read_files calls readdir, which reads in 32k batch (I think), system will still fetch quite many inodes. The first call is probably one that matters most for most application, or in most cases, in Emacs for Dired's purposes, so there is not much savings to directly to SYS_getdents directly so I agree with Eli that we don't need to go to Linux specific calls. The most effect we get on subsequent calls comes probably from Lisp itsel, by cutting of unnecessary lists traversals and list elements creation as well as comparing entire directory contents with regex to eliminate dots with such text. At least what I think currently, maybe I am wrong about, I am not really expert in systems programming, so I am not super on all the details.