From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24806 invoked by alias); 26 Jun 2016 23:28:38 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21709 Received: (qmail 21285 invoked from network); 26 Jun 2016 23:28:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Y60lnn2jnyVeM9BFkQn8Fx0vxyu33Zlg6/EZmqbOeNE=; b=SWzW7dFDAk8HEglwE/SKkSIwMrfkxIwkxz+KFWM66Zsucw5QwMRVGrFrXgnAjYRwUH paaioHc7/aE1th1ns5lO9bPYC2kH1UOicaQJ5Nz6wqGV4OdmRXSuxNdCYI/UqOyhFKD/ CMsUsd+uKha2o2+ArEFZCQ0N668GOHvPYzjPg8nX73C3Jfx2I6GBQbC0T+kb7biQO3dz BAH/4YmC5m/xOgVkh5zeBby1d+7/NRQshPv9ObOZF9uH/w8M3rwpFx1hQCRA7RUg+rFc J/LF8MEuRq/SX6wh5Pq/Hsfj0NV58JXJn6lgs25X+T+U1WtdZ72KdSC2YVqZdIfar+x4 gFRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=Y60lnn2jnyVeM9BFkQn8Fx0vxyu33Zlg6/EZmqbOeNE=; b=c4cdl6mhMvBZiQBlMFibfma9S5Af3jCWP98lrxWJjVygXIZ/b/IGecNcn+82A66hEx PNsyze2REInYtclRqsIhMcnMMqdtlSvm3akptFPp7MKu4O0lxuGCHzNmkiXT6W0zQ2fQ vcY/My9HYG1ImF5dpV0mvHF3Z4/DQCKG/hKf/yuAflZe6nXX94XJ32LoGkzqQl0gUuy8 GAaPqak41H63q1H7tmrxdKEqVcs7yXy/wvvYOoCO5Whbh4Gw+7bonuAi9uYXkAcAasgV xQR7rWAfZ+1GX1j2ADoXbhudbGkl4SbRxNwxVcG817bgqjEwZkiEXp5B5JZBHl/YTc/X vhcg== X-Gm-Message-State: ALyK8tIqiIhdj1TLwGp1YMK0qhlB6+HiPoOMLlOYNMqxnft+K70oKsDAUv+Y/Ec0SZcgJw== X-Received: by 10.66.16.133 with SMTP id g5mr28473548pad.145.1466983715583; Sun, 26 Jun 2016 16:28:35 -0700 (PDT) From: Bart Schaefer Message-Id: <160626162918.ZM20803@torch.brasslantern.com> Date: Sun, 26 Jun 2016 16:29:18 -0700 In-Reply-To: <6323851466876031@web5m.yandex.ru> Comments: In reply to "Nikolay Aleksandrovich Pavlov (ZyX)" "Re: Memory usage of history?" (Jun 25, 8:33pm) References: <20160624134706.GA22704@linux.vnet.ibm.com> <6323851466876031@web5m.yandex.ru> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: Memory usage of history? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 25, 8:33pm, Nikolay Aleksandrovich Pavlov (ZyX) wrote: } Subject: Re: Memory usage of history? } } 1. allows saving user-defined metada in history file and I'm not sure the answer to the history file being too large is to make it even larger by cramming in all sorts of other data. This would be even slower to parse at load time as well. } 2. allows user to get control over what exactly will be removed. In addition to all the other stuff I mentioned, I forgot about the relatively recent addition of the HISTORY_IGNORE variable, which can be a pattern that matches lines to leave out. That would be the best way to handle my "foo is a throwaway" and similar criteria. } Specifically first may be used to save information about } } 1. How often the command is used (total number of uses, anything else like } "uses per month" would be harder to determine). } 2. Time it took command to type (when it was typed for the first time) } (time between first self-insert (or $*BUFFER modification if it was } constructed by a widget) and accept-line). } 3. Last time command was run. } 4. Time it took command to finish (average among all runs). } 5. What was the exit code (hash exit code - number of times it occurred). I find these to be very unlikely criteria for deciding what's interesting in the history? For one thing, "time it took to type" is going to be really hard to get right; multi-line commands have multiple accept-line calls, and you'd have to filter out commands that were recalled from the history or you'd get an average much too small. Larger number of uses would be skewed towards really simple things, and in fact (at least in my own case) the LESS often I use a command, the more likely I am to want it from the history (unless it's one of those throwaways I mentioned in another message), because I can remember the ones I use a lot without zsh's help. If I use it often enough, I can make an alias or keybinding for it and not need to search history. How long the command took to run seems entirely unrelated to whether it is history-worthy (and also doesn't work with shared/incremental history). What would you use the exit code for, except maybe weeding out typos? I like Christian Neukirchen's idea of maintaining a daily archive. Adding a function / keybinding to search through an alternate history store seems more manageable than either having a huge history always in memory or a complicated AI for storing only interesting bits.