Damien Tournoud
2dcd745434
py/gc: Speed up incremental GC cycles by tracking the last used block.
...
In applications that use little memory and run GC regularly, the cost of
the sweep phase quickly becomes prohibitives as the amount of RAM
increases.
On an ESP32-S3 with 2 MB of external SPIRAM, for example, a trivial GC
cycle takes a minimum of 40ms, virtually all of it in the sweep phase.
Similarly, on the UNIX port with 1 GB of heap, a trivial GC takes 47 ms,
again virtually all of it in the sweep phase.
This commit speeds up the sweep phase in the case most of the heap is empty
by keeping track of the ID of the highest block we allocated in an area
since the last GC.
The performance benchmark run on PYBV10 shows between +0 and +2%
improvement across the existing performance tests. These tests don't
really stress the GC, so they were also run with gc.threshold(30000) and
gc.threshold(10000). For the 30000 case, performance improved by up to
+10% with this commit. For the 10000 case, performance improved by at
least +10% on 6 tests, and up to +25%.
Signed-off-by: Damien George <damien@micropython.org>
2023-08-04 17:25:16 +10:00
..
2022-12-06 13:34:52 +11:00
2022-05-23 14:21:16 +10:00
2022-05-23 14:21:16 +10:00
2023-04-27 18:03:06 +10:00
2022-06-20 22:28:18 +10:00
2023-04-27 18:03:06 +10:00
2022-05-23 23:01:12 +10:00
2022-05-17 14:25:51 +10:00
2022-05-23 14:21:16 +10:00
2020-06-27 00:24:04 +10:00
2022-05-23 14:21:16 +10:00
2022-03-30 16:32:17 +11:00
2022-05-23 14:21:16 +10:00
2022-03-28 15:43:09 +11:00
2022-11-28 11:23:22 +11:00
2022-12-08 12:27:23 +11:00
2022-08-23 13:09:57 +10:00
2019-09-02 13:14:27 +10:00
2023-06-14 19:03:46 +10:00
2023-06-02 21:59:47 +10:00
2023-06-08 17:54:24 +10:00
2023-07-13 14:56:33 +10:00
2023-07-13 13:50:50 +10:00
2022-12-08 12:27:23 +11:00
2022-09-19 19:06:15 +10:00
2022-08-11 14:00:13 +10:00
2023-03-09 12:13:12 +11:00
2023-04-27 18:03:06 +10:00
2023-03-09 12:13:12 +11:00
2022-05-23 15:43:06 +10:00
2022-05-23 15:43:06 +10:00
2022-05-26 12:22:07 +10:00
2020-10-22 11:47:36 +02:00
2022-05-23 15:43:06 +10:00
2023-04-27 18:03:06 +10:00
2022-05-23 15:43:06 +10:00
2022-05-23 15:43:06 +10:00
2022-05-23 15:43:06 +10:00
2022-05-23 15:43:06 +10:00
2022-05-23 15:43:06 +10:00
2023-04-27 18:03:06 +10:00
2017-07-31 18:35:40 +10:00
2022-02-24 18:08:43 +11:00
2022-05-25 13:04:45 +10:00
2023-08-04 17:25:16 +10:00
2023-03-10 10:58:10 +11:00
2020-06-16 23:18:01 +10:00
2023-06-14 19:11:04 +10:00
2022-05-25 13:04:45 +10:00
2022-07-18 13:48:23 +10:00
2023-04-27 18:03:06 +10:00
2023-06-14 19:03:46 +10:00
2023-02-02 12:51:03 +11:00
2023-06-08 17:54:24 +10:00
2023-03-10 18:39:14 +11:00
2022-05-05 10:31:50 +10:00
2023-01-13 14:21:32 +11:00
2022-10-12 00:33:09 +11:00
2022-09-29 14:17:37 +02:00
2023-02-08 12:24:15 +11:00
2023-06-15 11:02:15 +10:00
2023-06-08 17:54:21 +10:00
2023-04-27 18:03:06 +10:00
2022-06-02 16:31:37 +10:00
2023-06-08 17:54:21 +10:00
2023-06-08 17:54:21 +10:00
2022-06-02 16:31:37 +10:00
2023-06-08 17:54:21 +10:00
2023-02-24 15:55:12 +11:00
2023-03-10 10:58:10 +11:00
2023-06-08 17:54:21 +10:00
2023-06-14 19:03:46 +10:00
2022-09-19 19:06:15 +10:00
2023-07-24 23:53:20 +10:00
2023-06-08 17:54:11 +10:00
2020-09-18 17:20:34 +10:00
2020-12-07 23:32:06 +11:00
2022-08-10 14:30:47 +10:00
2017-07-31 18:35:40 +10:00
2023-08-04 17:25:16 +10:00
2020-02-28 10:33:03 +11:00
2021-12-21 18:00:05 +11:00
2021-12-21 18:00:05 +11:00
2022-05-17 14:25:51 +10:00
2022-05-17 14:25:51 +10:00
2023-06-02 21:50:57 +10:00
2023-06-02 21:50:57 +10:00
2023-06-14 17:43:44 +10:00
2022-11-15 17:09:49 +11:00
2022-08-11 14:04:13 +10:00
2023-06-02 21:47:34 +10:00
2020-02-28 10:33:03 +11:00
2021-05-18 11:52:00 +10:00
2020-02-28 10:33:03 +11:00
2020-02-28 10:33:03 +11:00
2023-06-01 14:18:54 +10:00
2023-06-08 17:54:24 +10:00
2023-05-19 13:33:54 +10:00
2023-01-20 16:31:37 +11:00
2022-09-19 19:06:15 +10:00
2023-06-08 17:54:11 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2023-06-08 17:54:11 +10:00
2022-09-19 19:06:15 +10:00
2023-06-08 17:54:11 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2023-05-19 12:04:44 +10:00
2022-02-24 18:08:43 +11:00
2023-05-19 12:04:44 +10:00
2017-07-31 18:35:40 +10:00
2022-09-19 19:06:15 +10:00
2023-06-01 13:01:07 +10:00
2023-06-01 13:01:07 +10:00
2023-06-01 15:11:06 +10:00
2020-05-28 10:02:14 +10:00
2023-06-08 17:54:11 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2023-06-14 19:03:46 +10:00
2023-06-14 19:03:46 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2023-06-08 17:54:11 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:15 +10:00
2023-05-19 12:04:44 +10:00
2023-05-19 12:06:06 +10:00
2023-06-08 17:54:11 +10:00
2022-10-11 17:50:19 +11:00
2023-07-21 18:49:03 +10:00
2017-06-09 17:33:01 +03:00
2023-06-08 17:54:11 +10:00
2023-06-08 17:54:11 +10:00
2020-02-28 10:33:03 +11:00
2023-06-01 13:01:07 +10:00
2022-09-19 19:06:16 +10:00
2022-09-19 19:06:15 +10:00
2022-09-19 19:06:07 +10:00
2020-03-26 01:21:04 +11:00
2020-03-26 01:21:04 +11:00
2023-06-08 17:54:11 +10:00
2022-04-14 22:44:56 +10:00
2023-06-14 17:32:01 +10:00
2022-06-23 11:46:47 +10:00
2020-02-28 10:33:03 +11:00
2017-07-31 18:35:40 +10:00
2022-12-08 12:27:23 +11:00
2022-12-08 12:27:23 +11:00
2023-05-19 12:04:44 +10:00
2022-02-24 18:08:43 +11:00
2023-06-08 17:54:17 +10:00
2023-06-08 17:54:17 +10:00
2021-07-15 00:12:41 +10:00
2020-02-28 10:33:03 +11:00
2022-08-11 23:18:02 +10:00
2022-08-11 23:18:02 +10:00
2022-03-10 10:58:33 +11:00
2022-09-19 23:27:08 +10:00
2017-03-14 11:52:05 +11:00
2023-06-08 17:54:21 +10:00
2022-03-10 10:58:33 +11:00
2023-05-01 16:47:03 +10:00
2023-05-01 16:47:03 +10:00
2023-06-01 13:01:07 +10:00
2017-12-05 00:38:41 +02:00
2023-07-24 15:04:27 +10:00
2023-06-08 17:54:24 +10:00
2023-03-21 18:08:57 +11:00
2022-02-24 18:08:43 +11:00
2023-04-27 18:03:06 +10:00
2023-04-27 18:03:06 +10:00
2022-03-28 15:43:09 +11:00
2017-07-31 18:35:40 +10:00
2022-03-25 12:23:43 +11:00
2023-05-04 10:08:12 +10:00
2021-06-05 11:03:09 +10:00
2023-07-21 18:49:03 +10:00
2023-07-21 18:49:03 +10:00
2020-02-28 10:33:03 +11:00
2017-09-06 16:43:09 +10:00
2021-03-31 00:26:01 +11:00
2023-03-21 18:08:57 +11:00
2020-10-22 11:47:36 +02:00
2020-02-28 10:33:03 +11:00
2019-02-06 00:19:00 +11:00