Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Poor performance when removing dynamic attributes #556

@mliszcz

Description

@mliszcz

I have a server which allows for adding and removing dynamic attributes:

  • CreateDynamicAttributes(500, 100) - create 500x double spectrum with 100 elements
  • ClearDynamicAttributes - remove all dynamic attributes

Removing 500 attributes takes more than a minute. Attribute creation is relatively fast.

I have had a look into the code. The problem is in MultiAttribute::remove_attribute which does MultiAttribute::check_associated for all attributes. The overall cost of a single remove_attribute call is thus proportional to N^2 string comparisons (N is the number of attributes). With 1000 attributes configured, removing a single attribute takes ~1 second.

Improvement idea: can we use Attribute* instead of string determine associated attribute?

Callgrind profile:
obraz

The helper code was generated by Pogo.
The server is located here

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