Skip to content

Implement a faster version of bracket and finally #677

@harendra-kumar

Description

@harendra-kumar

bracket and finally check for exceptions so that they can release the resource on exception. However this is very expensive and blocks fusion. The current version of bracket releases the resource on GC. If we do not proactively check for exceptions and do not release a resource on exception, the resource will finally be released on GC. This will make bracket much faster, at the expense of promptness of releasing the resource on exception. Note that it will still be promptly released in the normal path when the stream is done. The exception may anyway be handled somewhere up and as soon as the resource is not referenced it will be freed on GC.

Therefore, we can have two versions of bracket:

  1. the default bracket can have a less prompt but faster behavior
  2. a stricter version bracket' can have the current prompt release on exception behavior

Same applies to finally. Even after can have similar behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions