Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
garbage collection performance
#1
I am noticing that the Loboris port has reduced garbage collection performance compared to the mainline (please see test results and test code below).   Does anyone know if there is a way to configure the Loboris port to bring comparable performance to the mainline of uPy?   menuconfig setting?

Mainline (dec 20):
heap used =  80032 bytes, gc time = 28 ms
heap used = 128000 bytes, gc time = 28 ms
heap used = 176000 bytes, gc time = 28 ms
heap used = 224000 bytes, gc time = 29 ms
heap used = 272000 bytes, gc time = 29 ms
heap used = 320000 bytes, gc time = 29 ms
heap used = 368000 bytes, gc time = 30 ms
heap used = 416000 bytes, gc time = 30 ms
heap used = 480000 bytes, gc time = 31 ms

Loboris:
heap used =  80000 bytes, gc time = 27 ms
heap used = 128000 bytes, gc time = 34 ms
heap used = 176000 bytes, gc time = 41 ms
heap used = 224000 bytes, gc time = 48 ms
heap used = 272000 bytes, gc time = 55 ms
heap used = 320000 bytes, gc time = 62 ms
heap used = 368000 bytes, gc time = 69 ms
heap used = 416000 bytes, gc time = 77 ms
heap used = 480000 bytes, gc time = 86 ms

Note:  I have customized the Loboris port as per this fork:
https://github.com/MikeTeachman/MicroPyt...M_LoBo_I2S
(but...I don't think these customizations should affect garbage collection operation)

Using the following test code:

Code:
import gc
import time

for b in range(1, 10):
   h0 = gc.mem_free()
   for _ in range(1000):
       ba = bytearray(50*b)
       
   h1 = gc.mem_free()  
   t0 = time.ticks_ms()
   gc.collect()
   t1 = time.ticks_ms()
   print('heap used = {:6} bytes, gc time = {} ms'.format(h0-h1, t1-t0))
Reply
#2
It may be caused by some gc statistics turned on by default, I'll check it.
Also, if the heap is on psRAM, the gc will be slower.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)