You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

396 lines
67 KiB

<!DOCTYPE HTML>
<html lang="zh-CN" class="sidebar-visible no-js light">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>深入理解 move - Rust语言圣经(Rust Course)</title>
<!-- Custom HTML head -->
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<link rel="icon" href="../../favicon.svg">
<link rel="shortcut icon" href="../../favicon.png">
<link rel="stylesheet" href="../../css/variables.css">
<link rel="stylesheet" href="../../css/general.css">
<link rel="stylesheet" href="../../css/chrome.css">
<link rel="stylesheet" href="../../css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="../../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../../fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="../../highlight.css">
<link rel="stylesheet" href="../../tomorrow-night.css">
<link rel="stylesheet" href="../../ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="../../theme/style.css">
</head>
<body>
<!-- Provide site root to javascript -->
<script type="text/javascript">
var path_to_root = "../../";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script type="text/javascript">
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('light')
html.classList.add(theme);
html.classList.add('js');
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var html = document.querySelector('html');
var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
}
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item affix "><a href="../../about-book.html">关于本书</a></li><li class="chapter-item affix "><a href="../../into-rust.html">进入 Rust 编程世界</a></li><li class="chapter-item affix "><a href="../../first-try/sth-you-should-not-do.html">避免从入门到放弃</a></li><li class="chapter-item affix "><a href="../../community.html">社区和锈书</a></li><li class="chapter-item affix "><li class="part-title">Rust 语言基础学习</li><li class="spacer"></li><li class="chapter-item "><a href="../../first-try/intro.html"><strong aria-hidden="true">1.</strong> 寻找牛刀,以便小试</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../first-try/installation.html"><strong aria-hidden="true">1.1.</strong> 安装 Rust 环境</a></li><li class="chapter-item "><a href="../../first-try/editor.html"><strong aria-hidden="true">1.2.</strong> 墙推 VSCode!</a></li><li class="chapter-item "><a href="../../first-try/cargo.html"><strong aria-hidden="true">1.3.</strong> 认识 Cargo</a></li><li class="chapter-item "><a href="../../first-try/hello-world.html"><strong aria-hidden="true">1.4.</strong> 不仅仅是 Hello world</a></li><li class="chapter-item "><a href="../../first-try/slowly-downloading.html"><strong aria-hidden="true">1.5.</strong> 下载依赖太慢了?</a></li></ol></li><li class="chapter-item "><a href="../../basic/intro.html"><strong aria-hidden="true">2.</strong> Rust 基础入门</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../basic/variable.html"><strong aria-hidden="true">2.1.</strong> 变量绑定与解构</a></li><li class="chapter-item "><a href="../../basic/base-type/index.html"><strong aria-hidden="true">2.2.</strong> 基本类型</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../basic/base-type/numbers.html"><strong aria-hidden="true">2.2.1.</strong> 数值类型</a></li><li class="chapter-item "><a href="../../basic/base-type/char-bool.html"><strong aria-hidden="true">2.2.2.</strong> 字符、布尔、单元类型</a></li><li class="chapter-item "><a href="../../basic/base-type/statement-expression.html"><strong aria-hidden="true">2.2.3.</strong> 语句与表达式</a></li><li class="chapter-item "><a href="../../basic/base-type/function.html"><strong aria-hidden="true">2.2.4.</strong> 函数</a></li></ol></li><li class="chapter-item "><a href="../../basic/ownership/index.html"><strong aria-hidden="true">2.3.</strong> 所有权和借用</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../basic/ownership/ownership.html"><strong aria-hidden="true">2.3.1.</strong> 所有权</a></li><li class="chapter-item "><a href="../../basic/ownership/borrowing.html"><strong aria-hidden="true">2.3.2.</strong> 引用与借用</a></li></ol></li><li class="chapter-item "><a href="../../basic/compound-type/intro.html"><strong aria-hidden="true">2.4.</strong> 复合类型</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../basic/compound-type/string-slice.html"><strong aria-hidden="true">2.4.1.</strong> 字符串与切片</a></li><li class="chapter-item "><a href="../../basic/compound-type/tuple.html"><strong aria-hidden="true">2.4.2.</strong> 元组</a></li><li class="chapter-item "><a href="../../basic/compound-type/struct.html"><strong aria-hidden="true">2.4.3.</strong> 结构体</a></li><li class="chapter-item "><a href="../../basic/compound-type/enum.html"><strong aria-hidden="true">2.4.4.</strong> 枚举</a></li><li class="chapter-item "><a href="../../basic/compound-type/array.html"><strong aria-hidden="true">2.4.5.</strong> 数组</a></li></ol></li><li class="chapter-item "><a href="../../basic/flow-control.html"><strong aria-hidden="true">2.5.</strong> 流程控制</a></li><li class="chapter-item "><a href="../../basic/match-pattern/intro.html"><strong aria-hidde
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky bordered">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</button>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Rust语言圣经(Rust Course)</h1>
<div class="right-buttons">
<a href="../../print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/sunface/rust-course" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
<a href="https://github.com/sunface/rust-course/edit/main/src/profiling/performance/deep-into-move.md" title="Suggest an edit" aria-label="Suggest an edit">
<i id="git-edit-button" class="fa fa-edit"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script type="text/javascript">
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
// Get viewed page store
var viewed_key = 'mdbook-viewed';
var viewed_map = {};
try {
var viewed_storage = localStorage.getItem(viewed_key);
if (viewed_storage) {
viewed_map = JSON.parse(viewed_storage)
}
} catch (e) { }
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
// Apply viewed style
if (viewed_map[link.pathname]) {
link.classList.add('md-viewed')
}
});
// Mark viewed after 30s
setTimeout(function() {
viewed_map[location.pathname] = 1;
localStorage.setItem(viewed_key, JSON.stringify(viewed_map));
}, 30000)
</script>
<div id="content" class="content">
<!-- Page table of contents -->
<div class="sidetoc"><nav class="pagetoc"></nav></div>
<main>
<h1 id="rust所有权转移时发生了奇怪的深拷贝"><a class="header" href="#rust所有权转移时发生了奇怪的深拷贝">Rust所有权转移时发生了奇怪的深拷贝</a></h1>
<p>深拷贝可以说是Rust性能优化的禁忌之词但是在最不该发生深拷贝的地方却发生了, 本文带领大家来深入分析下原因。</p>
<p>在所有权章节中,我们详细介绍过<a href="https://course.rs/basic/ownership/ownership.html#%E8%BD%AC%E7%A7%BB%E6%89%80%E6%9C%89%E6%9D%83">所有权转移(move)</a>, 里面提到过一个重点:当类型实现<code>Copy</code>特征时,不会转移所有权,而是直接对值进行拷贝:</p>
<pre><pre class="playground"><code class="language-rust edition2021">fn main() {
let x = 1;
let y = x;
// 不会报错
println!(&quot;我(x)的值仅仅是被复制了,我还拥有值的所有权,不信你看:{:?}&quot;,x);
let s = &quot;aaa&quot;.to_string();
let s1 = s;
// 会报错
println!(&quot;我(s)的值被转移给了s1我已经失去所有权了: {}&quot;,s);
}
</code></pre></pre>
<p>这里的<code>x</code>是数值类型,因此实现了<code>Copy</code>特征,当赋值给<code>y</code>时,仅仅是复制了值,并没有把所有权转移给<code>y</code>,但是<code>s</code>恰好相反,它没有实现<code>Copy</code>特征,当赋值后,所有权被转移给<code>s1</code>,最终导致了最后一行代码的报错.</p>
<p>根据之前的所有权学习章节,所有权转移时的仅仅是复制一个引用,并不会复制底层的数据,例如上面代码中,<code>s</code>的所有权转移给<code>s1</code>时,仅仅是复制了一个引用,该引用继续指向之前的字符串底层数据,因此<strong>所有权转移的性能是非常高的</strong></p>
<p>但是如果一切都这么完美,也不会出现这篇文章了,实际上是怎么样?先来看一段代码.</p>
<h2 id="move时发生了数据的深拷贝"><a class="header" href="#move时发生了数据的深拷贝">move时发生了数据的深拷贝</a></h2>
<pre><pre class="playground"><code class="language-rust edition2021">struct LargeArray {
a: [i128; 10000],
}
impl LargeArray {
#[inline(always)]
fn transfer(mut self) -&gt; Self {
println!(&quot;{:?}&quot;, &amp;mut self.a[1] as *mut i128);
// 改变数组中的值
self.a[1] += 23;
self.a[4] += 24;
// 返回所有权
self
}
}
fn main() {
let mut f = LargeArray { a: [10i128; 10000] };
println!(&quot;{:?}&quot;, &amp;mut f.a[1] as *mut i128);
let mut f2 = f.transfer();
println!(&quot;{:?}&quot;, &amp;mut f2.a[1] as *mut i128);
}
</code></pre></pre>
<p>上面的例子很简单,创建了一个结构体<code>f</code>(内部有一个大数组),接着将它的所有权转移给<code>transfer</code>方法,最后再通过<code>Self</code>返回,转移给<code>f2</code>,在此过程中,观察结构体中的数组第二个元素的内存地址如何变化。</p>
<p>这里还有几个注意点:</p>
<ul>
<li><code>LargeArray</code>没有实现<code>Copy</code>特征,因此在所有权转移时, <strong>本应该</strong>只是复制一下引用,底层的数组并不会被复制</li>
<li><code>transfer</code>方法的参数<code>self</code>表示接收所有权,而不是借用,返回类型<code>Self</code>也表示返回所有权,而不是返回借用, 具体内容在<a href="https://course.rs/basic/method.html">方法</a>章节有介绍</li>
</ul>
<p>从上可知,我们并不应该去复制底层的数组,那么底层数组的地址也不应该变化,换而言之三次内存地址输出应该是同一个地址。但是真的如此吗?世事难料:</p>
<pre><code class="language-console">0x16f9d6870
0x16fa4bbc0
0x16fa24ac0
</code></pre>
<p>果然结果让人大跌眼镜竟然三次地址都不一样意味着每次转移所有权都发生了底层数组的深拷贝什么情况如果这样我们以后还能信任Rust吗完全不符合官方的宣传。</p>
<p>在福建有一个武夷山5A景区不仅美食特别好吃而且风景非常优美其中最著名的就是历时1个多小时的九曲十八弯漂流而我们的结论是否也能像漂游一样来个大转折大家拭目以待。</p>
<h2 id="罪魁祸首println"><a class="header" href="#罪魁祸首println">罪魁祸首println?</a></h2>
<p>首先,通过谷歌搜索,我发现了一些蛛丝马迹,有文章提到如果通过<code>println</code>输出内存地址,可能会导致编译器优化失效,也就是从本该有的所有权转移变成了深拷贝,不妨来试试。</p>
<p>但是问题又来了,如果不用<code>println</code>或者类似的方法我们怎么观察内存地址好像陷入了绝路。。。只能从Rust之外去想办法了此时大学学过的汇编发挥了作用</p>
<pre><code class="language-asm">.LCPI0_0:
.quad 10
.quad 0
example::xxx:
mov eax, 160000
call __rust_probestack
sub rsp, rax
mov rax, rsp
lea rcx, [rsp + 160000]
vbroadcasti128 ymm0, xmmword ptr [rip + .LCPI0_0]
.LBB0_1:
vmovdqu ymmword ptr [rax], ymm0
vmovdqu ymmword ptr [rax + 32], ymm0
vmovdqu ymmword ptr [rax + 64], ymm0
vmovdqu ymmword ptr [rax + 96], ymm0
vmovdqu ymmword ptr [rax + 128], ymm0
vmovdqu ymmword ptr [rax + 160], ymm0
vmovdqu ymmword ptr [rax + 192], ymm0
vmovdqu ymmword ptr [rax + 224], ymm0
vmovdqu ymmword ptr [rax + 256], ymm0
vmovdqu ymmword ptr [rax + 288], ymm0
vmovdqu ymmword ptr [rax + 320], ymm0
vmovdqu ymmword ptr [rax + 352], ymm0
vmovdqu ymmword ptr [rax + 384], ymm0
vmovdqu ymmword ptr [rax + 416], ymm0
vmovdqu ymmword ptr [rax + 448], ymm0
vmovdqu ymmword ptr [rax + 480], ymm0
vmovdqu ymmword ptr [rax + 512], ymm0
vmovdqu ymmword ptr [rax + 544], ymm0
vmovdqu ymmword ptr [rax + 576], ymm0
vmovdqu ymmword ptr [rax + 608], ymm0
add rax, 640
cmp rax, rcx
jne .LBB0_1
mov rax, qword ptr [rsp + 16]
mov rdx, qword ptr [rsp + 24]
add rax, 69
adc rdx, 0
add rsp, 160000
vzeroupper
ret
</code></pre>
<p>去掉所有<code>println</code>后的汇编生成如上所示(大家可以在godbolt上自己尝试),以我蹩脚的汇编水平来看,貌似没有任何数组拷贝的发生,也就是说:
如同量子的不可观测性,我们的<code>move</code>也这么傲娇我们用println观测它就傲娇去复制不观测时就老老实实转移所有权WTF!</p>
<p>事情感觉进入了僵局,下一步该如何办?</p>
<h2 id="栈和堆的不同move行为"><a class="header" href="#栈和堆的不同move行为">栈和堆的不同move行为</a></h2>
<p>我突然灵光一现,想到一个问题,之前的所有权转移其实可以分为两类:<strong>栈上数据的复制和堆上数据的转移</strong>,这也是非常符合直觉的,例如<code>i32</code>这种类型实现了<code>Copy</code>特征,可以存储在栈上,因此它就是复制行为,而<code>String</code>类型是引用存储在栈上,底层数据存储在堆上,因此转移所有权时只需要复制一下引用即可。</p>
<p>那问题来了,我们的<code>LargeArray</code>存在哪里?这也许就是一个破局点!</p>
<pre><pre class="playground"><code class="language-rust edition2021">
<span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>struct LargeArray {
a: [i128; 10000],
}
<span class="boring">}
</span></code></pre></pre>
<p>结构体是一个复合类型,它内部字段的数据存在哪里,就大致决定了它存在哪里。而该结构体里面的<code>a</code>字段是一个数组,而不是动态数组<code>Vec</code>,从<a href="https://course.rs/basic/compound-type/array.html#%E5%88%9B%E5%BB%BA%E6%95%B0%E7%BB%84">数组</a>章节可知:数组是存储在栈上的数据结构!</p>
<p>再想想,栈上的数据在<code>move</code>的时候,是要从一个栈复制到另外一个栈的,那是不是内存地址就变了?!因此,就能完美解释,为什么使用<code>println</code>时,数组的地址会变化了,是因为栈上的数组发生了复制。</p>
<p>但是问题还有,为什么不使用<code>println</code>,数组地址就不变?要解释清楚这个问题,先从编译器优化讲起。</p>
<h2 id="编译器对move的优化"><a class="header" href="#编译器对move的优化">编译器对move的优化</a></h2>
<p>从根本上来说,<code>move</code>就意味着拷贝复制,只不过看是浅拷贝还是深拷贝,对于堆上的数据来说,浅拷贝只复制引用,而栈上的数据则是整个复制。</p>
<p>但是在实际场景中,由于编译器的复杂实现,它能优化的场景远比我们想象中更多,例如对于<code>move</code>过程中的复制,编译器有可能帮你优化掉,在没有<code>println</code>的代码中,该<code>move</code>过程就被Rust编译器优化了。</p>
<p>但是这种编译器优化非常复杂而且随着Rust的版本更新在不停变化因此几乎没有人能说清楚这里面的门门道道但是有一点可以知道<strong><code>move</code>确实存在被优化的可能性,最终避免了复制的发生</strong>.</p>
<p>那么<code>println</code>没有被优化的原因也呼之欲出了: 它阻止了编译器对<code>move</code>的优化。</p>
<h2 id="println阻止了优化"><a class="header" href="#println阻止了优化">println阻止了优化</a></h2>
<p>编译器优化的一个基本准则就是:中间过程没有其它代码在使用,则可以尝试消除这些中间过程。</p>
<p>回头来看看<code>println</code>:</p>
<pre><pre class="playground"><code class="language-rust edition2021">
<span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>println!(&quot;{:?}&quot;, &amp;mut f.a[1] as *mut i128);
<span class="boring">}
</span></code></pre></pre>
<p>它需要打印数组在各个点的内存地址,假如编译器优化了复制,那这些中间状态的内存地址是不是就丢失了?对于这种可能会导致状态丢失的情况,编译器是不可能进行优化的,因此<code>move</code>时的栈上数组复制就顺理成章的发生了, 还是2次。</p>
<h2 id="最佳实践"><a class="header" href="#最佳实践">最佳实践</a></h2>
<p>那么,在实践中遇到这种情况怎么办?</p>
<h4 id="mut-self"><a class="header" href="#mut-self">&amp;mut self</a></h4>
<p>其实办法也很多,首当其冲的就是使用<code>&amp;mut self</code>进行可变借用,而不是转移进来所有权,再转移出去。</p>
<h4 id="box分配到堆上"><a class="header" href="#box分配到堆上">Box分配到堆上</a></h4>
<p>如果你确实需要依赖所有权的转移来实现某个功能(例如链式方法调用:<code>x.a().b()...</code>),那么就需要使用<code>Box</code>把该数组分配在堆上,而不是栈上:</p>
<pre><pre class="playground"><code class="language-rust edition2021">struct LargeArray {
a: Box&lt;[i128; 10000]&gt;,
}
impl LargeArray {
#[inline(always)]
fn transfer(mut self) -&gt; Self {
println!(&quot;{:?}&quot;, &amp;mut self.a[1] as *mut i128);
//do some stuff to alter it
self.a[1] += 23;
self.a[4] += 24;
//return the same object
self
}
}
fn main() {
let mut f = LargeArray { a: Box::new([10i128; 10000] )};
println!(&quot;{:?}&quot;, &amp;mut f.a[1] as *mut i128);
let mut f2 = f.transfer();
println!(&quot;{:?}&quot;, &amp;mut f2.a[1] as *mut i128);
}
</code></pre></pre>
<p>输出如下:</p>
<pre><code>0x138008010
0x138008010
0x138008010
</code></pre>
<p>完美符合了我们对堆上数据的预期hooray!</p>
<h4 id="神龟莫测的编译器优化"><a class="header" href="#神龟莫测的编译器优化">神龟莫测的编译器优化</a></h4>
<p>当然,你也可以选择相信编译器的优化,虽然很难识它真面目,同时它的行为也神鬼莫测,但是总归是在之前的例子中证明了,它确实可以,不是嘛? = , =</p>
<div id="giscus-container"></div>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../../profiling/performance/string.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="../../profiling/performance/early-optimise.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../../profiling/performance/string.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="../../profiling/performance/early-optimise.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script type="text/javascript">
window.playground_copyable = true;
</script>
<script src="../../ace.js" type="text/javascript" charset="utf-8"></script>
<script src="../../editor.js" type="text/javascript" charset="utf-8"></script>
<script src="../../mode-rust.js" type="text/javascript" charset="utf-8"></script>
<script src="../../theme-dawn.js" type="text/javascript" charset="utf-8"></script>
<script src="../../theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script>
<script src="../../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../mark.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../searcher.js" type="text/javascript" charset="utf-8"></script>
<script src="../../clipboard.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../highlight.js" type="text/javascript" charset="utf-8"></script>
<script src="../../book.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var pagePath = "profiling/performance/deep-into-move.md"
</script>
<!-- Custom JS scripts -->
<script type="text/javascript" src="../../assets/custom.js"></script>
<script type="text/javascript" src="../../assets/bigPicture.js"></script>
</body>
</html>