much faster grammar loading and dynamic updates

This commit is contained in:
Krasimir Angelov
2024-03-21 16:42:41 +01:00
parent 614f4b2dc9
commit d48a8d06c1
7 changed files with 70 additions and 112 deletions

View File

@@ -28,25 +28,6 @@ ref<C> vector_new(Vector<A> C::* field, size_t len)
return res;
}
PGF_INTERNAL_DECL size_t
get_next_padovan(size_t min);
/* Resize a vector by changing its length. If there is no enough space
* the implementation will create a copy, but whenever possible it will
* return the reference to the original vector. A copy is created also
* if txn_id is different from the current transaction. In this way
* it is safe to change the length. */
template <class A> inline PGF_INTERNAL
ref<Vector<A>> vector_resize(ref<Vector<A>> vec, size_t len, txn_t txn_id)
{
size_t new_len = get_next_padovan(len);
size_t old_len = get_next_padovan(vec->len);
vec = PgfDB::realloc<Vector<A>>(vec,old_len*sizeof(A),new_len*sizeof(A),txn_id);
vec->len = len;
return vec;
}
template <class A> inline PGF_INTERNAL
ref<A> vector_elem(ref<Vector<A>> v, size_t index)
{