From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jack Henahan Subject: `org-clock--oldest-date` performance Date: Sat, 20 Jan 2018 01:52:59 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecn1a-0007Aj-29 for emacs-orgmode@gnu.org; Sat, 20 Jan 2018 01:53:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecn1V-00060y-Gb for emacs-orgmode@gnu.org; Sat, 20 Jan 2018 01:53:10 -0500 Received: from ms11p00im-qufv17110601.me.com ([17.58.37.38]:25879) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecn1V-00060T-9z for emacs-orgmode@gnu.org; Sat, 20 Jan 2018 01:53:05 -0500 Received: from process-dkim-sign-daemon.ms11p00im-qufv17110601.me.com by ms11p00im-qufv17110601.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2U00600BAE0F00@ms11p00im-qufv17110601.me.com> for emacs-orgmode@gnu.org; Sat, 20 Jan 2018 06:53:04 +0000 (GMT) Received: from icloud.com ([127.0.0.1]) by ms11p00im-qufv17110601.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2U00D06DSCUY00@ms11p00im-qufv17110601.me.com> for emacs-orgmode@gnu.org; Sat, 20 Jan 2018 06:53:03 +0000 (GMT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hiya, I've run into a performance issue in `org-clock` which I've narrowed down to being caused by the calculation in the defconst for `org-clock--oldest-date`. In particular, invoking `org-clock-in` or eagerly loading `org-clock` on init incurs a 21(!) second delay while calculating the constant. If I inline the value (`(-1034058236842 -45726)`, in my case), the delay vanishes. So, context out of the way (just in case someone else already knows an easier fix), I'd like to spend some spare cycles finding a better way to go about the functionality this is meant to provide. If I've read the source correctly, it's meant to provide a view of all the clocks by showing all clocks between some time way in the past until now. I've read GNU Emacs bug #27706 [1] and attempted to reproduce to ensure that it's not just the libc issue again, but none of the apparently problematic examples cause any sort of hang. This leads me to believe that it's the `dichotomy` algorithm getting a bit out of control when `most-negative-fixnum` is -2^61. Right now I'm just `el-patch`ing the defconst and `org-clock-special-range`, but a more permanent solution would be desirable. I'll be looking at it this weekend to see if I can figure something out, but I thought it likely that someone who understands `org-clock` better than I might be able to chime in, or at least see if I'm the only one hitting this issue. Thanks, == Jack Henahan Org mode version 9.1.6 (release_9.1.6-369-g3604f2) on macOS 10.13.2