Summary
The overhead of loading import files is noticable
Metadata
- Id: 7e06890f3ef8b8a817a32a66fcbe99907cb39d32
- Trac id: 1172
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty: hard
- Resolution: fixed
- Priority: major
- Milestone: 5.0
- Version: 4.9.x
- Changetime: 2018-05-24 10:07:57 UTC
- Created: 2014-12-09 14:56:36 UTC
- Keywords: modules, loading
Attachments
- 7e06890f3ef8b8a817a32a66fcbe99907cb39d32/attachments/module-loading-benchmark.tar.2.gz
- 7e06890f3ef8b8a817a32a66fcbe99907cb39d32/attachments/module-loading-benchmark.tar.gz
Description
As reported by CaptainRant via IRC, the overhead in loading a .import.scm is quite a lot. This is an issue for CaptainRant in a project that involves loading plugins into a running binary.
Attached is a simple test case that compares loading a full module versus a simple "unit" style dynamic object.
The biggest overhead is in the call to "eval" in the generated import file. This can be ripped out with no consequence to the loading of the plugin; this may be due to the simplicity of the plugin or really due to the fact that there's no code running at toplevel which requires the evaled import. In any case, this should be improved.
Changes and comments
[2014-12-09 14:56:50 UTC] sjamaan attached module-loading-benchmark.tar.gz (description=#f)
[2015-08-27 09:06:55 UTC] sjamaan changed milestone from someday to 5.0
[2015-08-27 09:06:55 UTC] sjamaan wrote:
If we're going to change import stuff for CHICKEN 5, might as well take this into consideration
[2016-08-25 21:38:10 UTC] sjamaan set difficulty to hard
[2017-01-12 21:54:34 UTC] sjamaan changed milestone from 5.0 to 5.1
[2017-01-12 21:54:34 UTC] sjamaan wrote:
Can be done without user-visible changes, I think, so no reason to delay 5.0 for it.
[2018-04-29 12:25:17 UTC] sjamaan attached module-loading-benchmark.tar.2.gz (description=module benchmark, chicken 5 version)
[2018-04-29 12:26:52 UTC] sjamaan wrote:
This could be caused by `merge-se`
[2018-05-20 21:16:26 UTC] sjamaan wrote:
I think this is fixed with the patch for #1457:
Without the patch:
$ ./benchmark-loader >>> loading 'plugin.so' 0.052s CPU time, 3197/867 mutations (total/tracked), 3/85 GCs (major/minor), maximum live heap: 639.83 KiB >>> loading 'unit-plugin.so' 0s CPU time, 61/22 mutations (total/tracked), 0/1 GCs (major/minor), maximum live heap: 640.27 KiB
With the patch:
>>> loading 'plugin.so' 0s CPU time, 85/44 mutations (total/tracked), 0/1 GCs (major/minor), maximum live heap: 301.5 KiB >>> loading 'unit-plugin.so' 0.004s CPU time, 61/22 mutations (total/tracked), 0/1 GCs (major/minor), maximum live heap: 301.94 KiB
So we can close this when accepted.
[2018-05-20 21:16:26 UTC] sjamaan changed milestone from 5.1 to 5.0
[2018-05-24 10:07:57 UTC] sjamaan changed status from new to closed
[2018-05-24 10:07:57 UTC] sjamaan set resolution to fixed
[2018-05-24 10:07:57 UTC] sjamaan wrote:
Fixed with 36be0fc