Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a min-max heap implementation that can be used to back a priority queue #61

Merged
merged 63 commits into from
Aug 7, 2021

Commits on Aug 6, 2021

  1. Configuration menu
    Copy the full SHA
    91b7e50 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f81c588 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c42096c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    107a9b4 View commit details
    Browse the repository at this point in the history
  5. Implement our own swapAt()

    storage.swapAt exhibits excessive allocations
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    db87e18 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    101bc2c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1171c0a View commit details
    Browse the repository at this point in the history
  8. Use magic values 1, 2 to refer to the items in the first max level

    Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
    AquaGeek and Tim Vermeulen committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    11ba582 View commit details
    Browse the repository at this point in the history
  9. Specify logarithmic complexities as "O(log count) / 2" instead of "…

    …O(log n)"
    
    Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
    AquaGeek and Tim Vermeulen committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    a9efa56 View commit details
    Browse the repository at this point in the history
  10. Clarify logic in popMax

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    919c019 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    5cca169 View commit details
    Browse the repository at this point in the history
  12. Move the bounds checking into the various index computation methods

    They will all now return `nil` for invalid indices.
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    5b80eeb View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    9fe1481 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    1ceb496 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    9f319ab View commit details
    Browse the repository at this point in the history
  16. Add removeMin/removeMax

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    9182557 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    8e92d77 View commit details
    Browse the repository at this point in the history
  18. Split _indexOfChildOrGrandchild(of:sortedUsing:) into two separate fu…

    …nctions
    
    There is a large performance cost with passing a predicate function.
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    18de4fc View commit details
    Browse the repository at this point in the history
  19. Defer comparing children when determining largest/smallest descendant

    If the given index has 4 grandchildren, we can skip comparing the children.
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    25b88e6 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    0b46a53 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    daa4f94 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    ee35cc1 View commit details
    Browse the repository at this point in the history
  23. Fix code formatting

    Indentation of 2 spaces and 80 char column width
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    c095031 View commit details
    Browse the repository at this point in the history
  24. Add sequence initializer

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    6452adf View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    4f6471f View commit details
    Browse the repository at this point in the history
  26. Fix benchmark names

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    309fa96 View commit details
    Browse the repository at this point in the history
  27. Remove init from Collection

    This should already be handled by the init from Sequence
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    edc6bcd View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    43d13ea View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    feb9b7c View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    21efcf9 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    e8501bc View commit details
    Browse the repository at this point in the history
  32. Inline ALL THE THINGS!

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    6cb5842 View commit details
    Browse the repository at this point in the history
  33. Iterative instead of recursive implementation, @inline(__always) a co…

    …uple more critical functions.
    hassila authored and AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    07f0649 View commit details
    Browse the repository at this point in the history
  34. Address PR feedback, thanks!

    hassila authored and AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    fdcd604 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    593eadb View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    021704b View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    88faaee View commit details
    Browse the repository at this point in the history
  38. Fix missing empty line

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    2557ef1 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    a4f9ba0 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    69583d8 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    b8507fa View commit details
    Browse the repository at this point in the history
  42. Rename PriorityQueue -> MinMaxHeap

    We'll be reintroducing the PriorityQueue type as a wrapper.
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    cb78920 View commit details
    Browse the repository at this point in the history
  43. Mark insert(contentsOf:) as inlinable

    This results in ~10x speedup in my initial tests.
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    f3349e5 View commit details
    Browse the repository at this point in the history
  44. Rename argument label "startingAt" -> "elementAt"

    These functions used to be recursive, so "startingAt" made sense.
    Now that they're iterative, we should fix the label.
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    2bc784a View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    ceae6ea View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    272bb02 View commit details
    Browse the repository at this point in the history
  47. Rename MinMaxHeap -> Heap

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    d1c529e View commit details
    Browse the repository at this point in the history
  48. Add documentation for Heap

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    d7bf55d View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    60b6ab2 View commit details
    Browse the repository at this point in the history
  50. Fix reference to queue in documentation

    Co-authored-by: Dante Broggi <34220985+Dante-Broggi@users.noreply.github.com>
    AquaGeek and Dante-Broggi committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    c37395c View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    23dbd4f View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    7b633fd View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    b7a0f7f View commit details
    Browse the repository at this point in the history
  54. Add heap performance graph

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    55538df View commit details
    Browse the repository at this point in the history
  55. Apply suggestions from code review

    Co-authored-by: Karoy Lorentey <klorentey@apple.com>
    AquaGeek and lorentey committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    55b5500 View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    563c75e View commit details
    Browse the repository at this point in the history
  57. Split Heap.Iterator into two separate views

    Adapted from Daryle Walker's (github.com/CTMacUser) suggestions
    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    42fbc80 View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    32358a9 View commit details
    Browse the repository at this point in the history
  59. Update benchmark image

    AquaGeek committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    7d1044e View commit details
    Browse the repository at this point in the history
  60. Fix Sources/PriorityQueueModule/CMakeLists.txt

    Heap+Iterator.swift was renamed to Heap+OrderedViews.swift
    
    Co-authored-by: Karoy Lorentey <klorentey@apple.com>
    AquaGeek and lorentey committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    bd1f007 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2021

  1. Configuration menu
    Copy the full SHA
    c6a7954 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4bc94ac View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    083102e View commit details
    Browse the repository at this point in the history