Skip to content

Commit 44687c5

Browse files
fix: site build error
1 parent d92764d commit 44687c5

12 files changed

Lines changed: 797 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<mxfile host="app.diagrams.net">
2+
<diagram name="AoS Layout" id="aos-layout">
3+
<mxGraphModel dx="1000" dy="600" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0" />
6+
<mxCell id="1" parent="0" />
7+
8+
<mxCell id="title" value="AoS 布局:每个元素的 x,y,z,r,g,b 紧挨在一起(24 字节)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=16;fontStyle=1;" vertex="1" parent="1">
9+
<mxGeometry x="80" y="30" width="500" height="30" as="geometry" />
10+
</mxCell>
11+
12+
<!-- Vertex 0 -->
13+
<mxCell id="v0x" value="x₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
14+
<mxGeometry x="80" y="80" width="50" height="40" as="geometry" />
15+
</mxCell>
16+
<mxCell id="v0y" value="y₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
17+
<mxGeometry x="130" y="80" width="50" height="40" as="geometry" />
18+
</mxCell>
19+
<mxCell id="v0z" value="z₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
20+
<mxGeometry x="180" y="80" width="50" height="40" as="geometry" />
21+
</mxCell>
22+
<mxCell id="v0r" value="r₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
23+
<mxGeometry x="230" y="80" width="50" height="40" as="geometry" />
24+
</mxCell>
25+
<mxCell id="v0g" value="g₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
26+
<mxGeometry x="280" y="80" width="50" height="40" as="geometry" />
27+
</mxCell>
28+
<mxCell id="v0b" value="b₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
29+
<mxGeometry x="330" y="80" width="50" height="40" as="geometry" />
30+
</mxCell>
31+
32+
<!-- Vertex 1 -->
33+
<mxCell id="v1x" value="x₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
34+
<mxGeometry x="380" y="80" width="50" height="40" as="geometry" />
35+
</mxCell>
36+
<mxCell id="v1y" value="y₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
37+
<mxGeometry x="430" y="80" width="50" height="40" as="geometry" />
38+
</mxCell>
39+
<mxCell id="v1z" value="z₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
40+
<mxGeometry x="480" y="80" width="50" height="40" as="geometry" />
41+
</mxCell>
42+
<mxCell id="v1r" value="r₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
43+
<mxGeometry x="530" y="80" width="50" height="40" as="geometry" />
44+
</mxCell>
45+
<mxCell id="v1g" value="g₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
46+
<mxGeometry x="580" y="80" width="50" height="40" as="geometry" />
47+
</mxCell>
48+
<mxCell id="v1b" value="b₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
49+
<mxGeometry x="630" y="80" width="50" height="40" as="geometry" />
50+
</mxCell>
51+
52+
<!-- Legend -->
53+
<mxCell id="legend_g" value="坐标数据(热路径)" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=11;align=center;verticalAlign=middle;" vertex="1" parent="1">
54+
<mxGeometry x="200" y="145" width="130" height="28" as="geometry" />
55+
</mxCell>
56+
<mxCell id="legend_r" value="颜色数据(冷路径)" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=1;fillColor=#FFCDD2;fontSize=11;align=center;verticalAlign=middle;" vertex="1" parent="1">
57+
<mxGeometry x="370" y="145" width="130" height="28" as="geometry" />
58+
</mxCell>
59+
60+
</root>
61+
</mxGraphModel>
62+
</diagram>
63+
</mxfile>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<mxfile host="app.diagrams.net">
2+
<diagram name="Memory Hierarchy" id="memory-hierarchy">
3+
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0" />
6+
<mxCell id="1" parent="0" />
7+
8+
<!-- Title -->
9+
<mxCell id="title" value="内存层次结构金字塔" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=20;fontStyle=1;" vertex="1" parent="1">
10+
<mxGeometry x="200" y="20" width="300" height="35" as="geometry" />
11+
</mxCell>
12+
13+
<!-- Registers -->
14+
<mxCell id="reg" value="&lt;b&gt;寄存器&lt;/b&gt;&lt;br&gt;~1 周期 | ~数百字节" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#B71C1C;strokeWidth=2;fillColor=#FFCDD2;fontSize=14;align=center;verticalAlign=middle;" vertex="1" parent="1">
15+
<mxGeometry x="300" y="70" width="180" height="50" as="geometry" />
16+
</mxCell>
17+
18+
<!-- L1 -->
19+
<mxCell id="l1" value="&lt;b&gt;L1 Cache&lt;/b&gt;&lt;br&gt;~3-4 周期 | 32-64 KB" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#C62828;strokeWidth=2;fillColor=#EF9A9A;fontSize=14;align=center;verticalAlign=middle;" vertex="1" parent="1">
20+
<mxGeometry x="270" y="135" width="240" height="50" as="geometry" />
21+
</mxCell>
22+
23+
<!-- L2 -->
24+
<mxCell id="l2" value="&lt;b&gt;L2 Cache&lt;/b&gt;&lt;br&gt;~10-14 周期 | 256 KB - 1 MB" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#E65100;strokeWidth=2;fillColor=#FFCC80;fontSize=14;align=center;verticalAlign=middle;" vertex="1" parent="1">
25+
<mxGeometry x="230" y="200" width="320" height="50" as="geometry" />
26+
</mxCell>
27+
28+
<!-- L3 -->
29+
<mxCell id="l3" value="&lt;b&gt;L3 Cache&lt;/b&gt;&lt;br&gt;~30-50 周期 | 数 MB - 数十 MB" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#F9A825;strokeWidth=2;fillColor=#FFF59D;fontSize=14;align=center;verticalAlign=middle;" vertex="1" parent="1">
30+
<mxGeometry x="190" y="265" width="400" height="50" as="geometry" />
31+
</mxCell>
32+
33+
<!-- DRAM -->
34+
<mxCell id="dram" value="&lt;b&gt;主存 DRAM&lt;/b&gt;&lt;br&gt;~100-300 周期 | GB 级" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=2;fillColor=#A5D6A7;fontSize=14;align=center;verticalAlign=middle;" vertex="1" parent="1">
35+
<mxGeometry x="150" y="330" width="480" height="50" as="geometry" />
36+
</mxCell>
37+
38+
<!-- Disk -->
39+
<mxCell id="disk" value="&lt;b&gt;SSD / HDD&lt;/b&gt;&lt;br&gt;~微秒 / 毫秒 | TB 级" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#1565C0;strokeWidth=2;fillColor=#90CAF9;fontSize=14;align=center;verticalAlign=middle;" vertex="1" parent="1">
40+
<mxGeometry x="110" y="395" width="560" height="50" as="geometry" />
41+
</mxCell>
42+
43+
<!-- Left annotation: faster/smaller -->
44+
<mxCell id="left_label" value="快&lt;br&gt;↑&lt;br&gt;小&lt;br&gt;↑&lt;br&gt;贵" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=13;fontStyle=1;fontColor=#B71C1C;rotation=0;" vertex="1" parent="1">
45+
<mxGeometry x="30" y="130" width="50" height="250" as="geometry" />
46+
</mxCell>
47+
48+
<!-- Right annotation: slower/larger -->
49+
<mxCell id="right_label" value="慢&lt;br&gt;↓&lt;br&gt;大&lt;br&gt;↓&lt;br&gt;便宜" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=13;fontStyle=1;fontColor=#1565C0;" vertex="1" parent="1">
50+
<mxGeometry x="700" y="130" width="50" height="250" as="geometry" />
51+
</mxCell>
52+
53+
</root>
54+
</mxGraphModel>
55+
</diagram>
56+
</mxfile>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<mxfile host="app.diagrams.net">
2+
<diagram name="SoA Layout" id="soa-layout">
3+
<mxGraphModel dx="1000" dy="600" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0" />
6+
<mxCell id="1" parent="0" />
7+
8+
<mxCell id="title" value="SoA 布局:所有 x 连续,所有 y 连续,以此类推" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=16;fontStyle=1;" vertex="1" parent="1">
9+
<mxGeometry x="100" y="20" width="460" height="30" as="geometry" />
10+
</mxCell>
11+
12+
<!-- x array -->
13+
<mxCell id="xl" value="x[]" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=2;fillColor=#E8F5E9;fontSize=14;fontStyle=1;align=center;verticalAlign=middle;" vertex="1" parent="1">
14+
<mxGeometry x="80" y="70" width="50" height="35" as="geometry" />
15+
</mxCell>
16+
<mxCell id="x0" value="x₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
17+
<mxGeometry x="130" y="70" width="50" height="35" as="geometry" />
18+
</mxCell>
19+
<mxCell id="x1" value="x₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
20+
<mxGeometry x="180" y="70" width="50" height="35" as="geometry" />
21+
</mxCell>
22+
<mxCell id="x2" value="x₂" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
23+
<mxGeometry x="230" y="70" width="50" height="35" as="geometry" />
24+
</mxCell>
25+
<mxCell id="xd" value="x₃ x₄ ..." style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=12;align=center;verticalAlign=middle;dashed=1;" vertex="1" parent="1">
26+
<mxGeometry x="280" y="70" width="100" height="35" as="geometry" />
27+
</mxCell>
28+
29+
<!-- y array -->
30+
<mxCell id="yl" value="y[]" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=2;fillColor=#E8F5E9;fontSize=14;fontStyle=1;align=center;verticalAlign=middle;" vertex="1" parent="1">
31+
<mxGeometry x="80" y="115" width="50" height="35" as="geometry" />
32+
</mxCell>
33+
<mxCell id="y0" value="y₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
34+
<mxGeometry x="130" y="115" width="50" height="35" as="geometry" />
35+
</mxCell>
36+
<mxCell id="y1" value="y₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
37+
<mxGeometry x="180" y="115" width="50" height="35" as="geometry" />
38+
</mxCell>
39+
<mxCell id="y2" value="y₂" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
40+
<mxGeometry x="230" y="115" width="50" height="35" as="geometry" />
41+
</mxCell>
42+
<mxCell id="yd" value="y₃ y₄ ..." style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=12;align=center;verticalAlign=middle;dashed=1;" vertex="1" parent="1">
43+
<mxGeometry x="280" y="115" width="100" height="35" as="geometry" />
44+
</mxCell>
45+
46+
<!-- z array -->
47+
<mxCell id="zl" value="z[]" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=2;fillColor=#E8F5E9;fontSize=14;fontStyle=1;align=center;verticalAlign=middle;" vertex="1" parent="1">
48+
<mxGeometry x="80" y="160" width="50" height="35" as="geometry" />
49+
</mxCell>
50+
<mxCell id="z0" value="z₀" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
51+
<mxGeometry x="130" y="160" width="50" height="35" as="geometry" />
52+
</mxCell>
53+
<mxCell id="z1" value="z₁" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
54+
<mxGeometry x="180" y="160" width="50" height="35" as="geometry" />
55+
</mxCell>
56+
<mxCell id="z2" value="z₂" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
57+
<mxGeometry x="230" y="160" width="50" height="35" as="geometry" />
58+
</mxCell>
59+
<mxCell id="zd" value="z₃ z₄ ..." style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=12;align=center;verticalAlign=middle;dashed=1;" vertex="1" parent="1">
60+
<mxGeometry x="280" y="160" width="100" height="35" as="geometry" />
61+
</mxCell>
62+
63+
</root>
64+
</mxGraphModel>
65+
</diagram>
66+
</mxfile>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<mxfile host="app.diagrams.net">
2+
<diagram name="C OOP Memory Layout" id="oop-in-c-vtable">
3+
<mxGraphModel dx="1000" dy="600" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0" />
6+
<mxCell id="1" parent="0" />
7+
8+
<mxCell id="title" value="Circle 对象与全局 vtable 的内存布局" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=18;fontStyle=1;" vertex="1" parent="1">
9+
<mxGeometry x="140" y="30" width="400" height="30" as="geometry" />
10+
</mxCell>
11+
12+
<!-- Circle object -->
13+
<mxCell id="obj_box" value="" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=2;fillColor=#FFFFFF;" vertex="1" parent="1">
14+
<mxGeometry x="80" y="80" width="200" height="130" as="geometry" />
15+
</mxCell>
16+
<mxCell id="obj_title" value="Circle 对象(每个对象 1 个 vptr)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;fontSize=13;fontStyle=1;fontColor=#2E7D32;" vertex="1" parent="1">
17+
<mxGeometry x="90" y="85" width="180" height="20" as="geometry" />
18+
</mxCell>
19+
<mxCell id="vptr" value="&lt;b&gt;vptr&lt;/b&gt;" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#C8E6C9;fontSize=13;align=center;verticalAlign=middle;" vertex="1" parent="1">
20+
<mxGeometry x="90" y="115" width="180" height="28" as="geometry" />
21+
</mxCell>
22+
<mxCell id="name" value="name" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#E8F5E9;fontSize=13;align=left;verticalAlign=middle;spacingLeft=10;" vertex="1" parent="1">
23+
<mxGeometry x="90" y="143" width="180" height="28" as="geometry" />
24+
</mxCell>
25+
<mxCell id="radius" value="radius" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#2E7D32;strokeWidth=1;fillColor=#E8F5E9;fontSize=13;align=left;verticalAlign=middle;spacingLeft=10;" vertex="1" parent="1">
26+
<mxGeometry x="90" y="171" width="180" height="28" as="geometry" />
27+
</mxCell>
28+
29+
<!-- vtable -->
30+
<mxCell id="vt_box" value="" style="rounded=1;whiteSpace=wrap;html=1;strokeColor=#1565C0;strokeWidth=2;fillColor=#FFFFFF;" vertex="1" parent="1">
31+
<mxGeometry x="440" y="80" width="250" height="130" as="geometry" />
32+
</mxCell>
33+
<mxCell id="vt_title" value="kCircleVtable(全局共享)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;fontSize=13;fontStyle=1;fontColor=#1565C0;" vertex="1" parent="1">
34+
<mxGeometry x="460" y="85" width="210" height="20" as="geometry" />
35+
</mxCell>
36+
<mxCell id="fn1" value="circle_area" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#1565C0;strokeWidth=1;fillColor=#E3F2FD;fontSize=13;align=left;verticalAlign=middle;spacingLeft=10;" vertex="1" parent="1">
37+
<mxGeometry x="450" y="115" width="230" height="28" as="geometry" />
38+
</mxCell>
39+
<mxCell id="fn2" value="circle_perimeter" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#1565C0;strokeWidth=1;fillColor=#E3F2FD;fontSize=13;align=left;verticalAlign=middle;spacingLeft=10;" vertex="1" parent="1">
40+
<mxGeometry x="450" y="143" width="230" height="28" as="geometry" />
41+
</mxCell>
42+
<mxCell id="fn3" value="circle_draw" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#1565C0;strokeWidth=1;fillColor=#E3F2FD;fontSize=13;align=left;verticalAlign=middle;spacingLeft=10;" vertex="1" parent="1">
43+
<mxGeometry x="450" y="171" width="230" height="28" as="geometry" />
44+
</mxCell>
45+
46+
<!-- Arrow -->
47+
<mxCell id="arrow" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#FF6F00;strokeWidth=2;" edge="1" parent="1">
48+
<mxGeometry width="50" height="50" relative="1" as="geometry">
49+
<mxPoint x="270" y="129" as="sourcePoint" />
50+
<mxPoint x="440" y="129" as="targetPoint" />
51+
</mxGeometry>
52+
</mxCell>
53+
<mxCell id="arrow_label" value="vptr 指向" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=12;fontColor=#FF6F00;" vertex="1" parent="1">
54+
<mxGeometry x="320" y="110" width="70" height="20" as="geometry" />
55+
</mxCell>
56+
57+
</root>
58+
</mxGraphModel>
59+
</diagram>
60+
</mxfile>

0 commit comments

Comments
 (0)