Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gstreamer gstreamer
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 670
    • Issues 670
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 353
    • Merge requests 353
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gstreamergstreamer
  • Issues
  • #521

Closed
Open
Created 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
Time tracking