Skip to content

Loki connector frequent realllocations #22

Open

Description

@vyzigold

client.currentMessage.Streams = append(client.currentMessage.Streams, stream)

I'm just noting a possible issue. Wouldn't this line cause frequent extensions of the client.currentMessage.Streams, which would cause reallocations and slowdown? My recent performance tests didn't confirm this, but we might want to keep this in mind for the future.

Activity

  1. paramite commented on Mar 11, 2022

    @paramite
    Member

    Allocations happen exponentially, so first its 1 item slice, then 2 item slice then 4 item slice, etc. So there is space allocated in advance. But yes if we would know the final count of items, then it would be better to allocate once instead. But I believe we don't know the count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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