mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
don't make intermediate garbage when making vectors in the vm
* libguile/vm-i-system.c (vector): Don't cons up a list just to make a vector. Saves a couple percent in total cell allocation when loading syncase. Probably not worth it, but foo!
This commit is contained in:
parent
ac47d5f639
commit
5338b62b86
1 changed files with 9 additions and 2 deletions
|
@ -160,9 +160,16 @@ VM_DEFINE_INSTRUCTION (16, vector, "vector", 2, -1, 1)
|
|||
unsigned h = FETCH ();
|
||||
unsigned l = FETCH ();
|
||||
unsigned len = ((h << 8) + l);
|
||||
POP_LIST (len);
|
||||
SCM vect;
|
||||
|
||||
SYNC_REGISTER ();
|
||||
*sp = scm_vector (*sp);
|
||||
sp++; sp -= len;
|
||||
CHECK_UNDERFLOW ();
|
||||
vect = scm_make_vector (scm_from_uint (len), SCM_BOOL_F);
|
||||
memcpy (SCM_I_VECTOR_WELTS(vect), sp, sizeof(SCM) * len);
|
||||
NULLSTACK (len);
|
||||
*sp = vect;
|
||||
|
||||
NEXT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue