Ticket #209 (new enhancement)

Opened 8 months ago

Last modified 5 months ago

Optimize stack allocations in marshaler

Reported by: jasper Owned by: jasper
Priority: minor Milestone: Backlog
Component: COBIA Marshalling Version:
Keywords: Cc:

Description

Marshaled input arguments of variable are currently allocated of the heap.

For input arguments (that will not change), this can be optimized by using constant wrappers around the data, and allocate the actual data on the stack memory (extern the StackAllocate? block to fit the input data).

For output argument, the marshaler could use some form of buffering of COBIA data implementations (e.g. a pool of CapeArrayRealImpl? objects).

Change History

comment:1 Changed 6 months ago by jasper

Rather complex to implement as

  • the data is
    • either deserialized prior to the stack-allocate, so the heap allocation is already one,
    • or, in case of a separate data channel, the size of the data to be allocated is unknown at the point of the stack allocation
  • the data may come from COM; all COM data must be heap allocated (SysAllocString?, SafeArrayCreate?)

the gain may be limited as we do not have data on how much performance goes lost in stack allocations in a typical run

An alternative approach is to have fixed size generic preallocated 'stack' per marshaler that is used first, followed by actual heap allocations. To be considered further once we have a business case

comment:2 Changed 5 months ago by jasper

  • Milestone set to Backlog
Note: See TracTickets for help on using tickets.