Skip to content

Optimize C ABI boundaries #9

@mappu

Description

@mappu

The Go binding calls a C ABI binding, which calls the Qt C++ functions. Overall, it's somewhat efficient.

But to comply with the common C ABI, there are some places where data types must be converted, or moved onto the heap. This could be optimized in some cases.

Ideas:

  • Bypass malloc/free for zero-length strings and arrays
  • When returning a QString, have C++ fill in a Go-provided buffer, instead of copying the data twice
    • Current: C malloc - C strcpy - Cgo boundary - Go malloc - Go memcpy - Cgo boundary - C free - Cgo boundary - Go epilogue
    • Proposal: C calls go_malloc - Cgo boundary - Go malloc - Cgo boundary - C strcpy - Cgo boundary - Go epilogue
    • Same 3x boundaries

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions