1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v: reduce the memory usage of the compiler (analysed with heaptrack)

This commit is contained in:
Delyan Angelov
2021-05-06 11:44:48 +03:00
parent 84f9789e72
commit 2eafea6308
4 changed files with 13 additions and 7 deletions

View File

@@ -14,8 +14,8 @@ fn nr_next(prev u32) u32 {
// time_seed_array returns the required number of u32s generated from system time.
[inline]
pub fn time_seed_array(count int) []u32 {
ctime := time.now()
mut seed := u32(ctime.unix_time() ^ ctime.microsecond)
ctime := time.sys_mono_now()
mut seed := u32(ctime >> 32 ^ (ctime & 0x0000_0000_FFFF_FFFF))
mut seed_data := []u32{cap: count}
for _ in 0 .. count {
seed = nr_next(seed)