Speed up qstr loading by using the stack to store a temporary
string instead of the heap.
This commit is contained in:
parent
6560596864
commit
56bd0789af
@ -124,10 +124,9 @@ STATIC size_t read_uint(mp_reader_t *reader) {
|
|||||||
|
|
||||||
STATIC qstr load_qstr(mp_reader_t *reader) {
|
STATIC qstr load_qstr(mp_reader_t *reader) {
|
||||||
size_t len = read_uint(reader);
|
size_t len = read_uint(reader);
|
||||||
char *str = m_new(char, len);
|
char str[len];
|
||||||
read_bytes(reader, (byte*)str, len);
|
read_bytes(reader, (byte*)str, len);
|
||||||
qstr qst = qstr_from_strn(str, len);
|
qstr qst = qstr_from_strn(str, len);
|
||||||
m_del(char, str, len);
|
|
||||||
return qst;
|
return qst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user