---
title: Code motion
slug: code-motion
qid: 
snapshot: enwiki-001352684029
content_hash: 
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1352684029
tags: [23603337, 24927790, 26220375, 27610819, 28936235, 55610940, 68570080, 88057034]
---

# Code motion

> [!note] Provenance
> Snapshot `enwiki-001352684029` · content root `…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1352684029> · Licensed CC BY-SA 4.0

In computer science, code motion, which includes code hoisting, code sinking, loop-invariant code motion, and code factoring, is a blanket term for any process that moves code within a program. This is typically done for performance and size benefits, and it is a common optimization performed in most optimizing compilers.

In computer science, code motion, which includes code hoisting, code sinking, loop-invariant code motion, and code factoring, is a blanket term for any process that moves code within a program. This is typically done for performance and size benefits, and it is a common optimization performed in most optimizing compilers.
