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

Lazy robin hood hashing #14

Merged
merged 163 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
8f4eed0
Lazy robin hood hashing
dpdani Jan 6, 2024
256ca04
unused
dpdani Jan 6, 2024
c80ddae
delete (initial)
dpdani Jan 7, 2024
c789fdf
always skip tombstones
dpdani Jan 10, 2024
b87ac32
always skip tombstones (oops)
dpdani Jan 10, 2024
f101398
delete with lazy robin hood
dpdani Jan 12, 2024
09ea944
lint
dpdani Jan 12, 2024
3a0a8bc
show system info in test ci
dpdani Jan 12, 2024
dcc9599
mm, maybe ci is impacted by `null_seg`?
dpdani Jan 12, 2024
d9e9a15
Revert "mm, maybe ci is impacted by `null_seg`?"
dpdani Jan 12, 2024
b77ccf2
mm, maybe ci is impacted by `null_seg`? pt.2
dpdani Jan 12, 2024
8516325
Revert "mm, maybe ci is impacted by `null_seg`? pt.2"
dpdani Jan 12, 2024
8b485e9
mm, maybe ci is impacted by `null_seg`?
dpdani Jan 12, 2024
680c1a8
mm, maybe ci is impacted by `null_seg`? pt.2
dpdani Jan 12, 2024
f0ea6f5
Revert "mm, maybe ci is impacted by `null_seg`? pt.2"
dpdani Jan 12, 2024
13e81d4
Revert "mm, maybe ci is impacted by `null_seg`?"
dpdani Jan 12, 2024
a87d2f6
generate core dump files in ci 🙏
dpdani Jan 12, 2024
4f3b903
generate core dump files in ci 🙏
dpdani Jan 12, 2024
eb2eb3b
generate core dump files in ci 🙏
dpdani Jan 12, 2024
578aab4
generate core dump files in ci 🙏
dpdani Jan 12, 2024
d57e404
generate core dump files in ci 🙏
dpdani Jan 12, 2024
41d1cf4
generate core dump files in ci 🙏
dpdani Jan 12, 2024
ed6620c
generate core dump files in ci 🙏
dpdani Jan 12, 2024
bddb7e5
generate core dump files in ci 🙏
dpdani Jan 12, 2024
6c08e95
generate core dump files in ci 🙏
dpdani Jan 12, 2024
45a03cf
generate core dump files in ci 🙏
dpdani Jan 12, 2024
3323f3a
generate core dump files in ci 🙏
dpdani Jan 12, 2024
3c5be36
try skip this one
dpdani Jan 12, 2024
185668c
Revert "try skip this one"
dpdani Jan 12, 2024
a91069d
Revert "Revert "try skip this one""
dpdani Jan 12, 2024
285c8b6
Revert "try skip this one"
dpdani Jan 12, 2024
98d5e92
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
f8b3f2d
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
8b3419e
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
3fa6667
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
6f37366
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
cafea6d
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
89030a0
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
5cc04bd
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
807c2ed
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
57dcabe
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
517ca7b
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
2ee0a9b
Revert "Revert "mm, maybe ci is impacted by `null_seg`?""
dpdani Jan 12, 2024
d1071aa
Revert "Revert "mm, maybe ci is impacted by `null_seg`? pt.2""
dpdani Jan 12, 2024
123c235
Revert "mm, maybe ci is impacted by `null_seg`? pt.2"
dpdani Jan 12, 2024
63d558d
Revert "mm, maybe ci is impacted by `null_seg`?"
dpdani Jan 12, 2024
8c2732d
Revert "Revert "mm, maybe ci is impacted by `null_seg`? pt.2""
dpdani Jan 12, 2024
9d60e6b
Revert "mm, maybe ci is impacted by `null_seg`? pt.2"
dpdani Jan 12, 2024
be693e6
Revert "Revert "mm, maybe ci is impacted by `null_seg`?""
dpdani Jan 12, 2024
46c5a4b
Revert "mm, maybe ci is impacted by `null_seg`?"
dpdani Jan 12, 2024
bc9f5a9
Revert "show system info in test ci"
dpdani Jan 12, 2024
b529460
Revert "lint"
dpdani Jan 12, 2024
2942761
Revert "delete with lazy robin hood"
dpdani Jan 12, 2024
cd8933f
Revert "always skip tombstones (oops)"
dpdani Jan 12, 2024
a2c5558
Revert "always skip tombstones"
dpdani Jan 12, 2024
ce05780
Revert "delete (initial)"
dpdani Jan 12, 2024
74c3848
Revert "unused"
dpdani Jan 12, 2024
59583d7
Revert "Lazy robin hood hashing"
dpdani Jan 12, 2024
6e90c51
Revert "Revert "Lazy robin hood hashing""
dpdani Jan 12, 2024
07a015a
Revert "Revert "unused""
dpdani Jan 12, 2024
bd6c6c6
Revert "Revert "delete (initial)""
dpdani Jan 12, 2024
5f4694c
Revert "Revert "always skip tombstones""
dpdani Jan 12, 2024
ad1ad73
Revert "Revert "always skip tombstones (oops)""
dpdani Jan 12, 2024
20cca55
Revert "Revert "delete with lazy robin hood""
dpdani Jan 12, 2024
98c9c86
Revert "Revert "lint""
dpdani Jan 12, 2024
169bcb4
Revert "Revert "show system info in test ci""
dpdani Jan 12, 2024
8dbd52e
Revert "Revert "mm, maybe ci is impacted by `null_seg`?""
dpdani Jan 12, 2024
01bcbaa
Revert "Revert "Revert "mm, maybe ci is impacted by `null_seg`?"""
dpdani Jan 12, 2024
477ad04
Revert "Revert "mm, maybe ci is impacted by `null_seg`? pt.2""
dpdani Jan 12, 2024
2bdb629
Revert "Revert "Revert "mm, maybe ci is impacted by `null_seg`? pt.2"""
dpdani Jan 12, 2024
e5155dc
Revert "Revert "mm, maybe ci is impacted by `null_seg`?""
dpdani Jan 12, 2024
70ae109
Revert "Revert "mm, maybe ci is impacted by `null_seg`? pt.2""
dpdani Jan 12, 2024
ce4157e
Revert "Revert "Revert "mm, maybe ci is impacted by `null_seg`? pt.2"""
dpdani Jan 12, 2024
4303c4b
Revert "Revert "Revert "mm, maybe ci is impacted by `null_seg`?"""
dpdani Jan 12, 2024
3332fd6
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
1c7e00b
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
f3e0733
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
03781c5
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
f3f59a8
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
dc8cdac
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
b539db1
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
eea42e8
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
ac3352f
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
e4b136c
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
bb8b683
Revert "Revert "generate core dump files in ci 🙏""
dpdani Jan 12, 2024
6619f8b
Revert "Revert "try skip this one""
dpdani Jan 12, 2024
108279d
Revert "Revert "Revert "try skip this one"""
dpdani Jan 12, 2024
7e4ddb0
some more safety?
dpdani Jan 12, 2024
80ab320
generate core dump files in ci 🙏
dpdani Jan 12, 2024
da0d22a
generate core dump files in ci 🙏
dpdani Jan 12, 2024
7c053c9
generate core dump files in ci 🙏
dpdani Jan 12, 2024
9ae9655
generate core dump files in ci 🙏
dpdani Jan 12, 2024
cb0f717
generate core dump files in ci 🙏
dpdani Jan 12, 2024
2032fc5
generate core dump files in ci 🙏
dpdani Jan 12, 2024
146dd27
generate core dump files in ci 🙏
dpdani Jan 12, 2024
b323cc6
generate core dump files in ci 🙏
dpdani Jan 12, 2024
df653ac
generate core dump files in ci 🙏
dpdani Jan 12, 2024
b6f18c7
generate core dump files in ci 🙏
dpdani Jan 12, 2024
e9c444b
generate core dump files in ci 🙏
dpdani Jan 12, 2024
bd82120
generate core dump files in ci 🙏
dpdani Jan 12, 2024
173e1bc
generate core dump files in ci 🙏
dpdani Jan 12, 2024
596c5d0
generate core dump files in ci 🙏
dpdani Jan 12, 2024
a24a441
generate core dump files in ci 🙏
dpdani Jan 12, 2024
efc4568
generate core dump files in ci 🙏
dpdani Jan 12, 2024
c96f19d
generate core dump files in ci 🙏
dpdani Jan 12, 2024
beef925
generate core dump files in ci 🙏
dpdani Jan 12, 2024
b90ebe1
generate core dump files in ci 🙏
dpdani Jan 12, 2024
8dfe63f
generate core dump files in ci 🙏
dpdani Jan 12, 2024
a942afb
generate core dump files in ci 🙏
dpdani Jan 12, 2024
c8ad971
generate core dump files in ci 🙏
dpdani Jan 12, 2024
db3f0eb
generate core dump files in ci 🙏
dpdani Jan 12, 2024
9de13e7
generate core dump files in ci 🙏
dpdani Jan 12, 2024
5487021
generate core dump files in ci 🙏
dpdani Jan 12, 2024
49063c9
generate core dump files in ci 🙏
dpdani Jan 12, 2024
f389311
generate core dump files in ci 🙏
dpdani Jan 12, 2024
85c3867
generate core dump files in ci 🙏
dpdani Jan 12, 2024
ded7aa6
generate core dump files in ci 🙏
dpdani Jan 12, 2024
b7f2f5d
Revert "generate core dump files in ci 🙏"
dpdani Jan 12, 2024
a89977b
generate core dump files in ci 🙏
dpdani Jan 12, 2024
1c490ba
generate core dump files in ci 🙏
dpdani Jan 12, 2024
2d5d20b
generate core dump files in ci 🙏
dpdani Jan 12, 2024
ce9b070
generate core dump files in ci 🙏
dpdani Jan 12, 2024
28ad2e4
generate core dump files in ci 🙏
dpdani Jan 12, 2024
d68dffc
generate core dump files in ci 🙏
dpdani Jan 12, 2024
948523b
generate core dump files in ci 🙏
dpdani Jan 12, 2024
84c4a30
generate core dump files in ci 🙏
dpdani Jan 12, 2024
d96ebb7
generate core dump files in ci 🙏
dpdani Jan 12, 2024
b59351c
generate core dump files in ci 🙏
dpdani Jan 12, 2024
abebabb
generate core dump files in ci 🙏
dpdani Jan 12, 2024
8b0b029
generate core dump files in ci 🙏
dpdani Jan 12, 2024
2ffdcb3
generate core dump files in ci 🙏
dpdani Jan 12, 2024
d29defd
generate core dump files in ci 🙏
dpdani Jan 12, 2024
d03e600
generate core dump files in ci 🙏
dpdani Jan 12, 2024
0d03f5a
generate core dump files in ci 🙏
dpdani Jan 12, 2024
c2f50bc
generate core dump files in ci 🙏
dpdani Jan 12, 2024
3b2151e
generate core dump files in ci 🙏
dpdani Jan 12, 2024
db7dc86
generate core dump files in ci 🙏
dpdani Jan 12, 2024
3def0b4
generate core dump files in ci 🙏
dpdani Jan 12, 2024
2a5cf1f
don't try to free uninitialized meta
dpdani Jan 12, 2024
c19ae1f
renames
dpdani Jan 16, 2024
4bfe88e
will not recycle entries
dpdani Jan 16, 2024
1f12763
new helper AtomicDict_BufferedNodeReader
dpdani Jan 17, 2024
dc4842c
AtomicDict_ReadEntry
dpdani Jan 18, 2024
1934309
add compact stub
dpdani Jan 18, 2024
f3ef94f
ATOMIC_DICT_LOG_ENTRIES_IN_BLOCK, ATOMIC_DICT_ENTRIES_IN_BLOCK, Atomi…
dpdani Jan 18, 2024
2e484d2
compact stub
dpdani Jan 18, 2024
ef52f80
recycle entries
dpdani Jan 18, 2024
3460fda
do the swap
dpdani Jan 19, 2024
1a9d878
AtomicEvent
dpdani Jan 25, 2024
52f5e72
migrations 🎉
dpdani Jan 25, 2024
49ffb87
if you love your memory, let it be free 🕊
dpdani Jan 30, 2024
f0b466b
ruff being nit-picky
dpdani Jan 30, 2024
060281d
test_grow & various fixes
dpdani Jan 31, 2024
4408af3
more test_grow & more fixes
dpdani Feb 1, 2024
a838de1
shrink & compact & 👟🐞
dpdani Feb 9, 2024
2ec8ef4
timsort & 👟🐞
dpdani Feb 13, 2024
717ec61
remove restriction of log_size <= 25 & 👟🐞
dpdani Feb 15, 2024
7abf55f
moar 👟🐞
dpdani Feb 15, 2024
058e091
🏴
dpdani Feb 15, 2024
8e6c011
👟🐞
dpdani Feb 22, 2024
96c97dc
missing decref
dpdani Feb 22, 2024
41ca6cd
🔥
dpdani Feb 23, 2024
580a2f0
cleanups
dpdani Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,94 @@ jobs:
uses: dpdani/setup-python@nogil
with:
python-version: ${{ matrix.python-version }}
- name: system info
run: |
uname -a
cat /proc/cpuinfo
- name: check nogil
run: |
python -c "import sys; print(sys.flags.nogil);"
- name: install dependencies & cereggii
run: |
python -m pip install --upgrade pip
pip -V
pip install .[dev]
- name: test with pytest
run: |
ulimit -c unlimited
ulimit -c
sudo mkdir -p /cores/
sudo mkdir -p ./so-libs
sudo chmod -R 777 /cores/
sudo chmod -R 777 ./so-libs
echo "/cores/core-%e-%p-%t" | sudo tee /proc/sys/kernel/core_pattern
sudo cat /proc/sys/kernel/core_pattern
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
if: ${{ always() }}
- name: prepare shared libs
run: |
declare -a shared=(
"$pythonLocation/lib/python3.9/site-packages/cereggii/_cereggii.so"
"$pythonLocation/lib/python3.9/lib-dynload/pyexpat.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_decimal.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/unicodedata.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_elementtree.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_datetime.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_sha512.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_random.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_json.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/math.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/select.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_posixsubprocess.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_struct.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_lzma.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_bz2.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/libpython3.9.so.1.0"
"$pythonLocation/lib/python3.9/lib-dynload/_uuid.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_bisect.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/grp.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/zlib.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/binascii.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_csv.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/lib/python3.9/lib-dynload/_heapq.nogil-39b-x86_64-linux-gnu.so"
"$pythonLocation/bin/python3.9"
"/usr/lib/locale/locale-archive"
"/usr/lib/x86_64-linux-gnu/libc.so.6"
"/lib/x86_64-linux-gnu/libz.so.1"
"/lib/x86_64-linux-gnu/libpthread.so.0"
"/lib/x86_64-linux-gnu/libdl.so.2"
"/lib/x86_64-linux-gnu/libutil.so.1"
"/lib/x86_64-linux-gnu/libm.so.6"
"/lib/x86_64-linux-gnu/libc.so.6"
"/usr/lib/x86_64-linux-gnu/libz.so.1.2.11"
"/usr/lib/locale/C.utf8/LC_CTYPE"
"/usr/lib/x86_64-linux-gnu/libm.so.6"
"/usr/lib/x86_64-linux-gnu/libutil.so.1"
"/usr/lib/x86_64-linux-gnu/libdl.so.2"
"/usr/lib/x86_64-linux-gnu/libpthread.so.0"
"/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache"
"/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"
"/lib64/ld-linux-x86-64.so.2"
)

for f in "${shared[@]}"
do
mkdir -p $(dirname "./so-libs$f")
cp "$f" "./so-libs$f"
done
if: ${{ failure() }}
- name: upload core dump file
uses: actions/upload-artifact@v3
with:
name: core-dump
path: /cores
if: ${{ always() }}
- name: upload shared libs
uses: actions/upload-artifact@v3
with:
name: shared-libs
path: ./so-libs
if: ${{ always() }}
- name: upload pytest test results
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ Python3_add_library(_cereggii MODULE
"cereggii/atomic_dict/node_ops.c"
"cereggii/atomic_dict/node_sizes_table.c"
"cereggii/atomic_dict/reservation_buffer.c"
"cereggii/atomic_dict/robin_hood.c"
"cereggii/atomic_int/atomic_int.c"
"cereggii/atomic_int/handle.c"
"cereggii/atomic_event.c"
"cereggii/atomic_ops.c"
"cereggii/atomic_ref.c"
"cereggii/cereggii.c"
Expand Down
9 changes: 6 additions & 3 deletions src/cereggii/_cereggii.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from typing import Callable, NewType, SupportsComplex, SupportsFloat, SupportsInt

Key = NewType("Key", object)
Value = NewType("Value", object)
Value = NewType("Value", object | None)
Cancel = NewType("Cancel", object)

Number = SupportsInt | SupportsFloat | SupportsComplex

class AtomicDict:
"""A thread-safe dictionary (hashmap), that's almost-lock-free™."""

def __init__(self, iterable: dict | None = None, /, *, min_size: int | None = None, **kwargs):
def __init__(
self, iterable: dict | None = None, /, *, min_size: int | None = None, buffer_size: int | None = None, **kwargs
):
"""Constructor method

:param iterable: an iterable to initialize this dictionary with. For now,
Expand All @@ -29,7 +31,7 @@ class AtomicDict:
mapping ``initial_size`` to 123, but an empty one.
"""
# def __contains__(self, item: Key) -> bool: ...
# def __delitem__(self, item: Key) -> None: ...
def __delitem__(self, item: Key) -> None: ...
def __getitem__(self, item: Key) -> object: ...
# def __ior__(self, other) -> None: ...
# def __iter__(self) -> Iterable[Key, Value]: ...
Expand Down Expand Up @@ -125,6 +127,7 @@ class AtomicDict:
# :returns: None
# """
# def values(self) -> Iterable[Value]: ...
def compact(self) -> None: ...
def debug(self) -> dict: ...

class AtomicRef:
Expand Down
Loading
Loading