<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d" -->

---
title: ffi_call_plan caching for GLib | daily.dev
description: Anthony Green added a new &quot;call plan&quot; caching mechanism to libffi that caches the work of determining how to make a foreign function call, so subsequent calls...
canonical: https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: ffi_call_plan caching for GLib | daily.dev
og:description: Anthony Green added a new &quot;call plan&quot; caching mechanism to libffi that caches the work of determining how to make a foreign function call, so subsequent calls...
og:url: https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d
og:image: https://api.daily.dev/og/posts/fTb920c5d.png
og:image:alt: ffi_call_plan caching for GLib
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ffi_call_plan caching for GLib

**[Happenings in GNOME](https://daily.dev/sources/chergert)** · 1 min read · 0 upvotes · 0 comments

## Summary

Anthony Green added a new "call plan" caching mechanism to libffi that caches the work of determining how to make a foreign function call, so subsequent calls skip that overhead. Testing this against GLib's GClosure invocation showed roughly 25% reduction in amortized overhead in the best case, and about 10% in less ideal scenarios. A merge request bringing this to GLib exists but is blocked on CI needing the newest libffi. The author also patched libffi to add frame pointers, enabling stack unwinding across FFI boundaries with the Linux perf unwinder for better system profiling.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blogs.gnome.org/chergert/2026/07/24/ffi_call_plan-caching-for-glib>

## Questions this post answers

### What is the libffi call plan feature and how does it improve performance?

The call plan is a caching mechanism added to libffi by Anthony Green that stores the work of determining how to execute a foreign function call, so that work is skipped on subsequent invocations. Testing against GLib's GClosure invocation showed about a 25% reduction in amortized overhead in the best case and around 10% in less favorable scenarios.

_Developers optimizing FFI-heavy code paths can follow libffi and GLib performance work like this on daily.dev._

### Is there a GLib merge request to adopt the new libffi call plan caching?

Yes, a merge request exists in the GLib GitLab repository to integrate the libffi call plan caching feature, though it faces build system triage issues because it requires the newest version of libffi, which is currently blocking CI.

_Track GLib and libffi integration progress on daily.dev if you maintain code depending on either library._

## Similar posts on daily.dev

- [Performance improvements in libffi](https://daily.dev/posts/performance-improvements-in-libffi-uorjlcxs0) · Lobsters · 3 upvotes · 0 comments
- [The Fil-C Optimized Calling Convention](https://daily.dev/posts/the-fil-c-optimized-calling-convention-6dpn7xbze) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux), [#performance](https://daily.dev/tags/performance)

[View this post on daily.dev](https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"ffi_call_plan caching for GLib","url":"https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d"},"datePublished":"2026-08-31T05:54:37.334Z","dateModified":"2026-08-31T05:55:06.040Z","description":"Anthony Green added a new \"call plan\" caching mechanism to libffi that caches the work of determining how to make a foreign function call, so subsequent calls...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","isAccessibleForFree":true,"articleSection":"Happenings in GNOME","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Happenings in GNOME","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/chergert"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux,performance","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Happenings in GNOME","item":"https://daily.dev/sources/chergert"},{"@type":"ListItem","position":3,"name":"ffi_call_plan caching for GLib"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/ffi-call-plan-caching-for-glib-ftb920c5d#faq","mainEntity":[{"@type":"Question","name":"What is the libffi call plan feature and how does it improve performance?","acceptedAnswer":{"@type":"Answer","text":"The call plan is a caching mechanism added to libffi by Anthony Green that stores the work of determining how to execute a foreign function call, so that work is skipped on subsequent invocations. Testing against GLib's GClosure invocation showed about a 25% reduction in amortized overhead in the best case and around 10% in less favorable scenarios. Developers optimizing FFI-heavy code paths can follow libffi and GLib performance work like this on daily.dev."}},{"@type":"Question","name":"Is there a GLib merge request to adopt the new libffi call plan caching?","acceptedAnswer":{"@type":"Answer","text":"Yes, a merge request exists in the GLib GitLab repository to integrate the libffi call plan caching feature, though it faces build system triage issues because it requires the newest version of libffi, which is currently blocking CI. Track GLib and libffi integration progress on daily.dev if you maintain code depending on either library."}}]}
```

