Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
gstreamer
gstreamer
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 411
    • Issues 411
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 83
    • Merge Requests 83
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gstreamergstreamer
  • Issues
  • #521

Closed
Open
Opened Mar 11, 2020 by Edward Hervey@bilboed🤘Owner

Cost of string fields in caps

Using strings in caps values introduce the following overhead:

  • strdup for copying the value
  • strcmp for comparing the values
  • temporary memory copies (because of strdup) everywhere

Furthermore, those string values will be somewhat limited (they are well-known types).

It would be worthwile to investigate using "interned" strings for the G_TYPE_STRING values in the GstStructure of GstCaps. This can be done by using g_value_set_static_string() which will internally avoid copies and allow fast string comparision.

This could be done by having a "private" GHashTable in gstvalue.c for those strings (instead of clashing with the global GQuark hashtable).

This might introduce a small memory increase (because of the hashtable) but which should mitigate the overall memory usage of string copies everywhere.

Note that this should only be done for caps structures. Other usages don't imply uniqueness of string values.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: gstreamer/gstreamer#521