skip to main content
article
Free access

An efficient representation for sparse sets

Published: 01 March 1993 Publication History
  • Get Citation Alerts
  • Abstract

    Sets are a fundamental abstraction widely used in programming. Many representations are possible, each offering different advantages. We describe a representation that supports constant-time implementations of clear-set, add-member, and delete-member. Additionally, it supports an efficient forall iterator, allowing enumeration of all the members of a set in time proportional to the cardinality of the set.
    We present detailed comparisons of the costs of operations on our representation and on a bit vector representation. Additionally, we give experimental results showing the effectiveness of our representation in a practical application: construction of an interference graph for use during graph-coloring register allocation.
    While this representation was developed to solve a specific problem arising in register allocation, we have found it useful throughout our work, especially when implementing efficient analysis techniques for large programs. However, the new representation is not a panacea. The operations required for a particular set should be carefully considered before this representation, or any other representation, is chosen.

    References

    [1]
    AHO, A. V., HOPCROFT, J. E., AND ULLMAN, J.D. 1974. The Design and Analysis of Computer Algorithms. Addison-Wesley, Reading, Mass.
    [2]
    BENTLEY, J. 1986. Programming Pearls. Addison-Wesley, Reading, Mass.
    [3]
    BOEHM, H.-J., AND WEISER, M. 1988. Garbage collection in an uncooperative environment. Softw. Prac. Exp. 18, 9 (Sept.), 807-820.
    [4]
    BRIGGS, P. 1992. Register allocation via graph coloring. Ph.D. thesis, Rice Univ., Houston, Tex.
    [5]
    BRIGGS, P., COOPER, K. D., AND TORCZON, L. 1992. Rematerialization. SIGPLAN Not. 27, 7 (July), 311-321. Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation.
    [6]
    CHAITIN, G.J. 1982. Register allocation and spilling via graph coloring. SIGPLAN Not. 17, 6 (June), 98-105. Proceedings of the ACM SIGPLAN '82 Symposium on Compiler Construction.
    [7]
    CHAITIN, G. J., AUSLANDER, M. A., CHANDRA, A. K., COCKE, J., HOPKINS, M. E., AND MARKSTEIN, P.W. 1981. Register allocation via coloring. Comput. Lang. 6, 1 (Jan.), 47-57.
    [8]
    CYTRON, R., FERRANTE, J., ROSEN, B. K., WEGMAN, M. N., AND ZADECK, F.K. 1991. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13, 4 (Oct.), 451-490.
    [9]
    CYTRON, R., FERRANTE, J., ROSEN, B. K., WEGMAN, M. N., AND ZADECK, F.K. 1989. An efficient method of computing static single assignment form. In Conference Record of the 16th Annual ACM Symposium on the Principles of Programming Languages. ACM, New York, 25-35.
    [10]
    DEWAR, R. B. K., GRAND, A., LIU, S.-C., SCHWARTZ, J. T., AND SCHONBERG, E. 1979. Programming by refinement, as exemplified by the SETL representation sublanguage. ACM Trans. Program. Lang. Syst. 1, 1 (July), 27-49.
    [11]
    STANDARDS PERFORMANCE EVALUATION CORP. 1990. SPEC Release 1.2. SPEC Corp., Freemont, Calif.
    [12]
    WESTBROOK, J. AND TARJAN, R.E. 1989. Amortized analysis of algorithms for set union with backtracking. SIAM J. Comput. 18, 1 (Feb.), 1-11.
    [13]
    YELLIN, D.M. 1989. Representing sets with constant time equality testing. Tech. Rep. RC 14539, IBM, Yorktown Heights, N.Y.

    Cited By

    View all
    • (2024)Mata: A Fast and Simple Finite Automata LibraryTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-031-57249-4_7(130-151)Online publication date: 6-Apr-2024
    • (2023)Derivative Based Nonbacktracking Real-World Regex Matching with Backtracking SemanticsProceedings of the ACM on Programming Languages10.1145/35912627:PLDI(1026-1049)Online publication date: 6-Jun-2023
    • (2023)High-Quality Hypergraph PartitioningACM Journal of Experimental Algorithmics10.1145/352909027(1-39)Online publication date: 10-Feb-2023
    • Show More Cited By

    Recommendations

    Reviews

    Aaron M. Tenenbaum

    A time-efficient mechanism for representing sparse sets on a predetermined universe is presented. If the universe contains u elements, and the elements are represented by the integers from 0 to u-1 , the set is represented by two integer arrays and an integer. A dense array contains all the elements in the set in the first n positions. A sparse array contains, in position k if k is an element of the set, the position of k in the dense array. The integer is n , the number of elements in the set. Addition of a new element and deletion of an element are constant-time operations. Iteration over all elements of the set takes time proportional to the number of elements in the set, not to the size of the universe (as is true of bit-vector implementations) . The paper provides algorithms, efficiency analyses, and cost comparisons with bit vectors. It also lists a number of applications where the representation has been used successfully.

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Letters on Programming Languages and Systems
    ACM Letters on Programming Languages and Systems  Volume 2, Issue 1-4
    March–Dec. 1993
    241 pages
    ISSN:1057-4514
    EISSN:1557-7384
    DOI:10.1145/176454
    Issue’s Table of Contents

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 01 March 1993
    Published in LOPLAS Volume 2, Issue 1-4

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. compiler implementation
    2. register allocation
    3. set operations
    4. set representations

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)1,120
    • Downloads (Last 6 weeks)61
    Reflects downloads up to 07 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Mata: A Fast and Simple Finite Automata LibraryTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-031-57249-4_7(130-151)Online publication date: 6-Apr-2024
    • (2023)Derivative Based Nonbacktracking Real-World Regex Matching with Backtracking SemanticsProceedings of the ACM on Programming Languages10.1145/35912627:PLDI(1026-1049)Online publication date: 6-Jun-2023
    • (2023)High-Quality Hypergraph PartitioningACM Journal of Experimental Algorithmics10.1145/352909027(1-39)Online publication date: 10-Feb-2023
    • (2023)BibliographyEngineering a Compiler10.1016/B978-0-12-815412-0.00023-1(793-813)Online publication date: 2023
    • (2023)Data StructuresEngineering a Compiler10.1016/B978-0-12-815412-0.00022-X(769-791)Online publication date: 2023
    • (2022)Range minimum queries in minimal spaceTheoretical Computer Science10.1016/j.tcs.2022.01.025909:C(19-38)Online publication date: 28-Mar-2022
    • (2022)A Parallel Algorithm for GAC Filtering of the Alldifferent ConstraintIntegration of Constraint Programming, Artificial Intelligence, and Operations Research10.1007/978-3-031-08011-1_26(390-407)Online publication date: 20-Jun-2022
    • (2021)A Fresh Look at Zones and OctagonsACM Transactions on Programming Languages and Systems10.1145/345788543:3(1-51)Online publication date: 3-Sep-2021
    • (2021)Representative families for matroid intersections, with applications to location, packing, and covering problemsDiscrete Applied Mathematics10.1016/j.dam.2021.03.014298(110-128)Online publication date: Jul-2021
    • (2021)Finding Temporal Paths Under Waiting Time ConstraintsAlgorithmica10.1007/s00453-021-00831-w83:9(2754-2802)Online publication date: 4-Jun-2021
    • Show More Cited By

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Get Access

    Login options

    Full Access

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media