Skip to content

Cache ScalarFunctionArgs::config_options #180

@crepererum

Description

@crepererum

What

Avoid serializing ConfigOptions for every scalar UDF call.

Why

Currently we serialize the config options as key-value map:

config-options: list<tuple<string, string>>,

However on the host these options are passed as Arc<ConfigOptions> and ConfigOptions itself does NOT have interior mutability. It is likely that multiple calls to invoke_async_with_args will have the same config options attached and hence the whole stringify-parse roundtrip becomes an unnecessary overhead.

How

Please implement #28 first to gauge the impact of this change!

Instead of passing the config options as string map, we could use a WIT resource instead. Now we need to decide when to create and destroy that resource. On the host, we should keep a map "Arc address" -> Arc<ConfigOptions> & resource to cache that conversion. By keeping the Arc alive we make sure that the address is a true identity because it cannot be reused. We should probably limit the number of cached options in that map (I don't se why you would ever need more than one TBH).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions