# Underrust: What is the cost of sync::Once?

DevFeed: [Underrust: What is the cost of sync::Once?](<https://devfeed.tech/articles/underrust-what-is-the-cost-of-sync-once-35384.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/cost-of-sync-once/>)

Author: Graham King

Published: 2022-09-18T07:00:00Z

Content type: article

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Assembly](<https://devfeed.tech/topics/assembly.md>), [Latency](<https://devfeed.tech/topics/latency.md>)

Tags: [assembly](<https://devfeed.tech/tags/assembly.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [performance](<https://devfeed.tech/tags/performance.md>), [rust](<https://devfeed.tech/tags/rust.md>), [software](<https://devfeed.tech/tags/software.md>), [underrust](<https://devfeed.tech/tags/underrust.md>)

## AI overview

This article analyzes the cost of calling Rust's std::sync::Once after initialization. It explains that repeated calls usually take a fast path, with the function call commonly inlined, a branch that is normally predicted correctly, and a small number of machine instructions whose latency is estimated for an Intel Tiger Lake CPU.

## Source excerpt

In Rust, what is the performance cost of using sync::Once after the initial setup?