From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#56255: 28.1.50; sxhash-equal does not change when object is modified Date: Wed, 29 Jun 2022 20:56:31 +0800 Message-ID: <87czerk4qo.fsf@localhost> References: <87v8sm70ma.fsf@localhost> <87y1xhu34f.fsf@gnus.org> <87r139u2y6.fsf@gnus.org> <874k05q70i.fsf@gnus.org> <87sfnokz6p.fsf@localhost> <87o7yblreq.fsf@gnus.org> <87r137kcbt.fsf@localhost> <87fsjnlqrh.fsf@gnus.org> <87ilojk5tq.fsf@localhost> <875ykjhcgh.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15797"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56255@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 29 16:08:08 2022 Return-path: Envelope-to: geb-bug-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 1o6YMR-0003tF-Q8 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 16:08:07 +0200 Original-Received: from localhost ([::1]:55576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6YMQ-0006Lm-Ii for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 10:08:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6XEg-0000r4-CI for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 08:56:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6XEg-00037n-2Y for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 08:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6XEg-000614-06 for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 08:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jun 2022 12:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56255 X-GNU-PR-Package: emacs Original-Received: via spool by 56255-submit@debbugs.gnu.org id=B56255.165650732923071 (code B ref 56255); Wed, 29 Jun 2022 12:56:01 +0000 Original-Received: (at 56255) by debbugs.gnu.org; 29 Jun 2022 12:55:29 +0000 Original-Received: from localhost ([127.0.0.1]:58006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6XE8-000602-QP for submit@debbugs.gnu.org; Wed, 29 Jun 2022 08:55:29 -0400 Original-Received: from mail-pg1-f173.google.com ([209.85.215.173]:41745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6XE7-0005zo-V1 for 56255@debbugs.gnu.org; Wed, 29 Jun 2022 08:55:28 -0400 Original-Received: by mail-pg1-f173.google.com with SMTP id 23so15236608pgc.8 for <56255@debbugs.gnu.org>; Wed, 29 Jun 2022 05:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=8SDNAug+J+PSArvVv4cHhU0fIl4mPbCw4RkSb9rVx1Q=; b=ETD5ZLVHjqetdF4nDlVvldKiemo5F72wRFacTmcJbHTOkUIHTnMohvWHZdAxSdCrMF 0+nCQrwAXJ1/JbsAF3dODSqgjsVepzEVf0g+R33CGWpirho0KyL159zuPGp8kGo7neXv 8FNiZ5q1zybeE1J5snMZlOo9M62B71FEIf8LRUJqPLh72qhSS3RmSOp2+l+OdWLq/RsN UI8AjjX+3/ujKYnR1pycFiNQmbDSdsbF1tHUxJrGVdup/RE16allyjk26Nbg7EVs6Ze0 K2N9LqI1HlOF5JjwOMXF07ZKDiO04Mu9ZYXH+Lz2cA6ugll/8LHBwnlmqZo0rOdQt4HO bTLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=8SDNAug+J+PSArvVv4cHhU0fIl4mPbCw4RkSb9rVx1Q=; b=jeTaETr5QdgaJmob+jyF3AFG8BoD4MY9B0Xs6afaxLaRHGotV0aq1UlMLjpttocNnq x4aTPQRo/vdNo+pMiThH44tKXXTPtOhhK/XOvb7eUgqpU5vAQGKqMf1Z66Owl0ZFAagz YkAKRnNSFIRc4SWtmqoz4ucPkShjpNTR1DOV49jSXI/OcmLSoR/MyafwOkbMq5UQjAD/ 7gvwzSpCHnKf9NMRRXjDT9sh4T/h6yXqSVXgc09dywoheE/7Pd3tFrmqsnLXRQAAFbg+ R1tTvtN7XeFhqy4Fdlki2Kn1qZFodhek4wXkhBy9SSsG6wsExkNpXqBG0TT4xh8G/Iyn l0LA== X-Gm-Message-State: AJIora/PCF+sCGSq4muFlJC32LmAchJzs2ZuLc5bhsT8ODD8zf1g00c5 ks9+WS6tT3NHPs6e9EecORE= X-Google-Smtp-Source: AGRyM1vuROB/TczMdVyGhXyvfGkH/VoxL12GBkpw6Y2RHBvYq4Ritt/oh8886nVCKI1Zt5T1buK31A== X-Received: by 2002:a05:6a00:2295:b0:525:6c57:8dea with SMTP id f21-20020a056a00229500b005256c578deamr9182339pfe.62.1656507322056; Wed, 29 Jun 2022 05:55:22 -0700 (PDT) Original-Received: from localhost ([155.94.207.39]) by smtp.gmail.com with ESMTPSA id r1-20020a17090a0ac100b001ef0a9467dasm2039551pje.23.2022.06.29.05.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 05:55:21 -0700 (PDT) In-Reply-To: <875ykjhcgh.fsf@gnus.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235636 Archived-At: Lars Ingebrigtsen writes: > Ihor Radchenko writes: > >> The original idea was to detect changed objects in most generic way, as >> a part of persistent storage library. Oh well. > > We could make SXHASH_MAX_DEPTH into a defvar -- or pass the depth in to > `sxhash-equal'. However, the hash it's computing is geared towards hash > tables, so collisions are OK -- it's not a cryptographic hash, so I'm > not sure it would fit your use case anyway. I.e., our sxhash_combine is > very simple. Well. In my scenario, the object structure creates so bad case that _all_ the hashes for _all possible_ avl-tree structures collide (actually, I use plists containing avl-tree structures). As for the hash tables and collisions. Are you sure that collisions are OK? Consider the following example: (setq a (avl-tree--create #'org-element--cache-compare)) (avl-tree-enter a '(headline (:begin 2))) (setq tbl (make-hash-table :test #'equal)) (puthash a 'value tbl) (gethash a tbl) (plist-put (nth 1 (avl-tree-first a)) :begin 10) (gethash a tbl) ;; the value does not change! Best, Ihor