<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq" -->

---
title: The Cost of Indirection in Rust | daily.dev
description: Function call indirection in Rust async code is almost never a real performance concern. The Rust compiler in release mode frequently inlines extracted helper...
canonical: https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The Cost of Indirection in Rust | daily.dev
og:description: Function call indirection in Rust async code is almost never a real performance concern. The Rust compiler in release mode frequently inlines extracted helper...
og:url: https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq
og:image: https://api.daily.dev/og/posts/qQZ41BKAq.png
og:image:alt: The Cost of Indirection in Rust
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.

# The Cost of Indirection in Rust

**[Hacker News](https://daily.dev/sources/hn)** · 8 min read · 23 upvotes · 1 comments

## Summary

Function call indirection in Rust async code is almost never a real performance concern. The Rust compiler in release mode frequently inlines extracted helper functions, producing identical assembly to inlined code. The actual costs worth worrying about are I/O, locks, and allocations — not function call boundaries, which cost only a few CPU cycles. Real indirection overhead only matters in tight inner loops, with dyn Trait dynamic dispatch, or in explicitly performance-critical paths. The post argues that premature inlining sacrifices code readability, testability, and maintainability for no measurable gain, and recommends using profilers like callgrind or perf to verify actual bottlenecks before optimizing. The right approach is to extract well-named functions, trust the optimizer, and only reach for #[inline] when profiler data justifies it.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.sebastiansastre.co/posts/cost-of-indirection-in-rust/>

## Community discussion

Top comments from developers on daily.dev.

**@khauma** · 1 upvotes

> Very interesting take, I will have to think on it some more.

## Similar posts on daily.dev

- [It’s Not Always ICache](https://daily.dev/posts/it-s-not-always-icache-huqohyo6p) · Lobsters · 0 upvotes · 0 comments
- [Why is calling my asm function from Rust slower than calling it from C?](https://daily.dev/posts/why-is-calling-my-asm-function-from-rust-slower-than-calling-it-from-c--h7khzgipm) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#compiler-optimization](https://daily.dev/tags/compiler-optimization), [#performance](https://daily.dev/tags/performance), [#rust](https://daily.dev/tags/rust)

[View this post on daily.dev](https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq)

```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":"The Cost of Indirection in Rust","url":"https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq"},"datePublished":"2026-03-13T00:58:10.167Z","dateModified":"2026-03-30T02:20:05.695Z","description":"Function call indirection in Rust async code is almost never a real performance concern. The Rust compiler in release mode frequently inlines extracted helper...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/48d288e5cfeb5458f7e5494453c377f8?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/48d288e5cfeb5458f7e5494453c377f8?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Hacker News","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":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":23},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"compiler-optimization,performance,rust","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"The Cost of Indirection in Rust"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/the-cost-of-indirection-in-rust-qqz41bkaq","comment":[{"@type":"Comment","text":"Very interesting take, I will have to think on it some more.","datePublished":"2026-03-13T15:21:18.728Z","url":"https://daily.dev/posts/qQZ41BKAq#c-xZk6izvd9","author":{"@type":"Person","name":"Kahlil Wallace","url":"https://daily.dev/khauma","image":"https://media.daily.dev/image/upload/s--QvppE9Ip--/f_auto/v1767378558/avatars/avatar_7eQFeSQRDx0muV3n92gxT?_a=BAMAK+ZW0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

