filedictrb 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/filedict/filedict.h +12 -11
- data/lib/filedict/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cb1c1d801bf8943d6493a6c40be882c5d47c58166c56b6860abf8b98fc14a98
|
4
|
+
data.tar.gz: 394f0febd55f827bfb3aafb3559ba89b6b458b3a7ed2c3b6d857d900e38b7374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a700778e49bd15c6686b9457b7a7987f4d6c8b47be4abf805a6a09d95156ce71ff8e15e7cb50ffcfa11f96e78f3eb633c19d10bf472c6f7963deb5ae658f9f4
|
7
|
+
data.tar.gz: dc233039e2c4d0e2aade78efc7cd6b55ab088cbdeaa373d9219137ae1241585dbe32b4e5984eeb402c52a32a027ee14f2950fa5540b3a3b932a34d13ff834b8c
|
data/ext/filedict/filedict.h
CHANGED
@@ -120,15 +120,17 @@ static void filedict_deinit(filedict_t *filedict) {
|
|
120
120
|
* This computes the size of the entire filedict file given an initial bucket count and hashmap count.
|
121
121
|
*/
|
122
122
|
static size_t filedict_file_size(size_t initial_bucket_count, size_t hashmap_count) {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
123
|
+
/*
|
124
|
+
* We used to size each additional hashmap at 2x the previous, but realistically it seems that
|
125
|
+
* most resizes are triggered by keys that are ridiculously large, not by mass collision.
|
126
|
+
*
|
127
|
+
* A more proper fix might be to re-structure the whole filedict. We could keep the existing
|
128
|
+
* hashmap structure, but with buckets that expand dynamically. This would require each bucket
|
129
|
+
* to contain a "pointer" to the next bucket object if present.
|
130
|
+
*
|
131
|
+
* For now, it's easiser to just keep the hashmap duplication without the size doubling.
|
132
|
+
*/
|
133
|
+
return sizeof(filedict_header_t) + initial_bucket_count * hashmap_count * sizeof(filedict_bucket_t);
|
132
134
|
}
|
133
135
|
|
134
136
|
/*
|
@@ -289,7 +291,6 @@ try_again:
|
|
289
291
|
|
290
292
|
++hashmap_i;
|
291
293
|
hashmap += bucket_count;
|
292
|
-
bucket_count = (bucket_count << 1);
|
293
294
|
}
|
294
295
|
|
295
296
|
/*
|
@@ -409,7 +410,7 @@ static int filedict_read_advance_hashmap(filedict_read_t *read) {
|
|
409
410
|
|
410
411
|
filedict_bucket_t *hashmap = filedict->data + offset;
|
411
412
|
|
412
|
-
read->bucket_count = (size_t)header->initial_bucket_count
|
413
|
+
read->bucket_count = (size_t)header->initial_bucket_count;
|
413
414
|
read->bucket = &hashmap[read->key_hash % read->bucket_count];
|
414
415
|
read->entry = &read->bucket->entries[0];
|
415
416
|
|
data/lib/filedict/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filedictrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Baillie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.3
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Uses filedict to emulate a file-backed Hash<Set<String>>
|