* In theory, this should reduce the number of ATermMap
re-allocations.
This commit is contained in:
parent
4ada6db1fc
commit
2b3b6c9b34
2 changed files with 4 additions and 3 deletions
|
@ -26,7 +26,7 @@ void EvalState::addPrimOp(const string & name,
|
||||||
/* Substitute an argument set into the body of a function. */
|
/* Substitute an argument set into the body of a function. */
|
||||||
static Expr substArgs(Expr body, ATermList formals, Expr arg)
|
static Expr substArgs(Expr body, ATermList formals, Expr arg)
|
||||||
{
|
{
|
||||||
ATermMap subs;
|
ATermMap subs(ATgetLength(formals) * 2);
|
||||||
Expr undefined = makeUndefined();
|
Expr undefined = makeUndefined();
|
||||||
|
|
||||||
/* Get the formal arguments. */
|
/* Get the formal arguments. */
|
||||||
|
|
|
@ -50,9 +50,10 @@ void ATermMap::copy(const ATermMap & map)
|
||||||
{
|
{
|
||||||
ATermList keys = map.keys();
|
ATermList keys = map.keys();
|
||||||
|
|
||||||
/* !!! adjust allocation for load pct */
|
/* !!! We adjust for the maximum load pct by allocating twice as
|
||||||
|
much. Probably a bit too much. */
|
||||||
maxLoadPct = map.maxLoadPct;
|
maxLoadPct = map.maxLoadPct;
|
||||||
table = ATtableCreate(ATgetLength(keys), maxLoadPct);
|
table = ATtableCreate(ATgetLength(keys) * 2, maxLoadPct);
|
||||||
if (!table) throw Error("cannot create ATerm table");
|
if (!table) throw Error("cannot create ATerm table");
|
||||||
|
|
||||||
add(map, keys);
|
add(map, keys);
|
||||||
|
|
Loading…
Reference in a new issue