guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/02: Slight optimization to invert-bijectiono


From: Andy Wingo
Subject: [Guile-commits] 02/02: Slight optimization to invert-bijectiono
Date: Thu, 28 May 2020 04:58:49 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit d36b9f0422bc5959ed278c581326ab61566f1af7
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Thu May 28 10:58:09 2020 +0200

    Slight optimization to invert-bijectiono
    
    * module/language/cps/graphs.scm (invert-bijection): Use a transient
      intmap.
---
 module/language/cps/graphs.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/module/language/cps/graphs.scm b/module/language/cps/graphs.scm
index c2b9f19..a32b7b4 100644
--- a/module/language/cps/graphs.scm
+++ b/module/language/cps/graphs.scm
@@ -1,6 +1,6 @@
 ;;; Continuation-passing style (CPS) intermediate language (IL)
 
-;; Copyright (C) 2013-2015, 2017-2019 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2015, 2017-2020 Free Software Foundation, Inc.
 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -82,7 +82,8 @@ member, or @code{#f} otherwise."
   "Assuming the values of @var{map} are integers and are unique, compute
 a map in which each value maps to its key.  If the values are not
 unique, an error will be signalled."
-  (intmap-fold (lambda (k v out) (intmap-add out v k)) map empty-intmap))
+  (persistent-intmap
+   (intmap-fold (lambda (k v out) (intmap-add! out v k)) map empty-intmap)))
 
 (define (invert-partition map)
   "Assuming the values of @var{map} are disjoint intsets, compute a map



reply via email to

[Prev in Thread] Current Thread [Next in Thread]