Opened 4 years ago

Closed 4 weeks ago

#1172 closed defect (fixed)

The overhead of loading import files is noticable

Reported by: sjamaan Owned by:
Priority: major Milestone: 5.0
Component: core libraries Version: 4.9.x
Keywords: modules, loading Cc:
Estimated difficulty: hard

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.

Attachments (2)

module-loading-benchmark.tar.gz (918 bytes) - added by sjamaan 4 years ago.
module-loading-benchmark.tar.2.gz (958 bytes) - added by sjamaan 8 weeks ago.
module benchmark, chicken 5 version

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by sjamaan

comment:1 Changed 3 years ago by sjamaan

  • Milestone changed from someday to 5.0

If we're going to change import stuff for CHICKEN 5, might as well take this into consideration

comment:2 Changed 22 months ago by sjamaan

  • Estimated difficulty set to hard

comment:3 Changed 18 months ago by sjamaan

  • Milestone changed from 5.0 to 5.1

Can be done without user-visible changes, I think, so no reason to delay 5.0 for it.

Changed 8 weeks ago by sjamaan

module benchmark, chicken 5 version

comment:4 Changed 8 weeks ago by sjamaan

This could be caused by merge-se

comment:5 Changed 5 weeks ago by sjamaan

  • Milestone changed from 5.1 to 5.0

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.

comment:6 Changed 4 weeks ago by sjamaan

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with 36be0fc

Note: See TracTickets for help on using tickets.