diff --git a/include/pocketpy/tuplelist.h b/include/pocketpy/tuplelist.h index fedd5436..c698e3a6 100644 --- a/include/pocketpy/tuplelist.h +++ b/include/pocketpy/tuplelist.h @@ -7,7 +7,7 @@ namespace pkpy { -using List = pod_vector; +using List = pod_vector; struct Tuple { PyObject** _args; diff --git a/include/pocketpy/vector.h b/include/pocketpy/vector.h index fefb645e..8c10d41b 100644 --- a/include/pocketpy/vector.h +++ b/include/pocketpy/vector.h @@ -5,7 +5,7 @@ namespace pkpy{ -template +template struct pod_vector{ static constexpr int SizeT = sizeof(T); static constexpr int N = 64 / SizeT; @@ -60,13 +60,13 @@ struct pod_vector{ template void push_back(__ValueT&& t) { - if (_size == _capacity) reserve(_capacity*2); + if (_size == _capacity) reserve(_capacity*Growth); _data[_size++] = std::forward<__ValueT>(t); } template void emplace_back(Args&&... args) { - if (_size == _capacity) reserve(_capacity*2); + if (_size == _capacity) reserve(_capacity*Growth); new (&_data[_size++]) T(std::forward(args)...); } @@ -110,7 +110,7 @@ struct pod_vector{ template void insert(int i, __ValueT&& val){ - if (_size == _capacity) reserve(_capacity*2); + if (_size == _capacity) reserve(_capacity*Growth); for(int j=_size; j>i; j--) _data[j] = _data[j-1]; _data[i] = std::forward<__ValueT>(val); _size++; diff --git a/src/dict.cpp b/src/dict.cpp index f94e9981..6532f4c5 100644 --- a/src/dict.cpp +++ b/src/dict.cpp @@ -66,7 +66,7 @@ namespace pkpy{ ItemNode* old_nodes = _nodes; int old_head_idx = _head_idx; - _capacity *= 2; + _capacity *= 4; _mask = _capacity - 1; _size = 0; _critical_size = _capacity*__LoadFactor+0.5f;