Skip to content

Allow making conditional regions #392

@Kixiron

Description

@Kixiron

Scope::region() and Scope::region_named() have intrinsic overhead since in order to report events about all sub-operators it has to observe the traffic that they send and receive. In order to combat this, timely should offer some sort of optional region that takes a boolean which determines whether or not the region acts like Scope::region()/Scope::region_named() or whether it does nothing and is a noop. Regions are incredibly helpful for debugging and visualizing dataflows, but in large codebases they can end up having non-trivial overhead.

Example Code

Since writing something like this is not only painful for developers (and not always possible because of the dreaded generics) but also hurts both code reuse and compile times

if regions_are_enabled {
    scope.region(|region| {
        // ...inner dataflow graph
    })
} else {
    // ...inner dataflow graph
}

Optional regions would allow writing this instead

scope.optional_region(regions_are_enabled, |region| {
    // ...inner dataflow graph
})

As per usual the normal Scope::optional_region() and Scope::optional_region_named() (or maybe Scope::optional_named_region()?) should be offered so that users can name the regions

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