{"id":361848,"date":"2024-05-21T01:22:20","date_gmt":"2024-05-21T01:22:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=361848"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T01:22:20","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=361848","title":{"rendered":"<span>std fs \u0432 Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python? \u041d\u0435\u0442, \u044d\u0442\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u0431\u0430\u0433<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a57\/62a\/01d\/a5762a01dd6fa096fbc1cd7f6926317d.png\" width=\"1564\" height=\"612\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a57\/62a\/01d\/a5762a01dd6fa096fbc1cd7f6926317d.png\"\/><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u0434\u043e\u043b\u0433\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>op.read()<\/code>\u00a0<a href=\"https:\/\/github.com\/apache\/incubator-opendal\" rel=\"noopener noreferrer nofollow\">opendal<\/a>, \u0430 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c. \u042d\u0442\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435. \u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u0432\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044e \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435.<\/p>\n<blockquote>\n<p>\u0412\u0441\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\" rel=\"noopener noreferrer nofollow\">Xuanwo\/when-i-find-rust-is-slow<\/a><\/p>\n<\/blockquote>\n<h3>TL;DR<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0441\u0440\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442, \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0443 \u00ab\u0412\u044b\u0432\u043e\u0434\u00bb.<\/p>\n<h3>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 OpenDAL \u043a Python \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p><a href=\"https:\/\/github.com\/apache\/incubator-opendal\" rel=\"noopener noreferrer nofollow\">OpenDAL<\/a>\u00a0\u2014 \u044d\u0442\u043e \u0441\u043b\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u043b\u044f OpenDAL \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u043a Python \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"https:\/\/github.com\/PyO3\/pyo3\" rel=\"noopener noreferrer nofollow\">pyo3<\/a>.<\/p>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b @beldathas \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u043d\u0435 \u0432 <a href=\"https:\/\/discord.com\/channels\/1081052318650339399\/1174840499576770560\" rel=\"noopener noreferrer nofollow\">discord<\/a>\u00a0\u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 OpenDAL \u043a python \u043c\u0435\u0434\u043b\u0435\u043d\u0435\u0435, \u0447\u0435\u043c python:<\/p>\n<pre><code class=\"python\">import pathlib import timeit  import opendal  root = pathlib.Path(__file__).parent op = opendal.Operator(\"fs\", root=str(root)) filename = \"lorem_ipsum_150mb.txt\"  def read_file_with_opendal() -> bytes:     with op.open(filename, \"rb\") as fp:         result = fp.read()     return result  def read_file_with_normal() -> bytes:     with open(root \/ filename, \"rb\") as fp:         result = fp.read()     return result  if __name__ == \"__main__\":     print(\"normal: \", timeit.timeit(read_file_with_normal, number=100))     print(\"opendal: \", timeit.timeit(read_file_with_opendal, number=100)) <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code>(venv) $ python benchmark.py normal:  4.470868484000675 opendal:  8.993250704006641 <\/code><\/pre>\n<p>\u0422\u0430\u043a-\u0442\u0430\u043a-\u0442\u0430\u043a. \u041c\u0435\u043d\u044f \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043f\u043e\u0440\u0430\u0437\u0438\u043b\u0438 \u044d\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0438\u043f\u043e\u0442\u0435\u0437:<\/p>\n<ul>\n<li>\n<p>\u0423 Python \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043a\u044d\u0448, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043c\u044f\u0442\u044c?<\/p>\n<\/li>\n<li>\n<p>\u0423 Python \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u0440\u044e\u043a, \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0438\u0439 \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432?<\/p>\n<\/li>\n<li>\n<p>\u041b\u0438\u0448\u043d\u044f\u044f \u0442\u0440\u0430\u0442\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 PyO3?<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u043e\u0442\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043b \u043a\u043e\u0434:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/python-fs-read\/test.py\" rel=\"noopener noreferrer nofollow\">python-fs-read<\/a>:<\/p>\n<pre><code class=\"python\">with open(\"\/tmp\/file\", \"rb\") as fp:     result = fp.read() assert len(result) == 64 * 1024 * 1024 <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/python-opendal-read\/test.py\" rel=\"noopener noreferrer nofollow\">python-opendal-read<\/a>:<\/p>\n<pre><code class=\"python\">import opendal  op = opendal.Operator(\"fs\", root=str(\"\/tmp\"))  result = op.read(\"file\") assert len(result) == 64 * 1024 * 1024 <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e python \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 opendal:<\/p>\n<pre><code>Benchmark 1: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.9 ms \u00b1   0.7 ms    [User: 5.6 ms, System: 10.1 ms]   Range (min \u2026 max):    14.9 ms \u2026  21.6 ms    180 runs    Benchmark 2: python-opendal-read\/test.py   Time (mean \u00b1 \u03c3):      32.9 ms \u00b1   1.3 ms    [User: 6.1 ms, System: 26.6 ms]   Range (min \u2026 max):    31.4 ms \u2026  42.6 ms    85 runs    Summary   python-fs-read\/test.py ran     2.07 \u00b1 0.12 times faster than python-opendal-read\/test.py <\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 OpenDAL \u043a Python \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439, \u0447\u0435\u043c \u0441\u0430\u043c Python, \u0438 \u044d\u0442\u043e \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0432 \u0447\u0451\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430.<\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441 OpenDAL Fs \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0430\u0437\u043b\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 rust, opendal, python \u0438 pyo3. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0447\u0438\u043d\u0443.<\/p>\n<p>\u042f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 opendal fs \u043d\u0430 rust:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/rust-opendal-fs-read\/src\/main.rs\" rel=\"noopener noreferrer nofollow\">rust-opendal-fs-read<\/a>:<\/p>\n<pre><code class=\"rust\">use std::io::Read; use opendal::services::Fs; use opendal::Operator;  fn main() {     let mut cfg = Fs::default();     cfg.root(\"\/tmp\");     let op = Operator::new(cfg).unwrap().finish().blocking();      let mut bs = vec![0; 64 * 1024 * 1024];      let mut f = op.reader(\"file\").unwrap();     let mut ts = 0;     loop {         let buf = &amp;mut bs[ts..];         let n = f.read(buf).unwrap();         let n = n as usize;         if n == 0 {             break         }         ts += n;     }      assert_eq!(ts, 64 * 1024 * 1024); } <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e opendal \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c python, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 opendal \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 rust:<\/p>\n<pre><code>Benchmark 1: rust-opendal-fs-read\/target\/release\/test   Time (mean \u00b1 \u03c3):      23.8 ms \u00b1   2.0 ms    [User: 0.4 ms, System: 23.4 ms]   Range (min \u2026 max):    21.8 ms \u2026  34.6 ms    121 runs   Benchmark 2: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.6 ms \u00b1   0.8 ms    [User: 5.5 ms, System: 10.0 ms]   Range (min \u2026 max):    14.4 ms \u2026  20.8 ms    166 runs   Summary   python-fs-read\/test.py ran     1.52 \u00b1 0.15 times faster than rust-opendal-fs-read\/target\/release\/test <\/code><\/pre>\n<p>\u0425\u043e\u0442\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438<code>rust-opendal-fs-read<\/code>\u00a0\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0443 <code>python-opendal-read<\/code>, \u0447\u0442\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0438 pyo3, \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0433\u043b\u0443\u0431\u0436\u0435.<\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 opendal fs \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c python.<\/p>\n<h3>std fs Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p>OpenDAL \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 fs \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/doc.rust-lang.org\/std\/fs\/index.html\" rel=\"noopener noreferrer nofollow\">std::fs<\/a>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u0432\u044b\u0437\u0432\u0430\u043d\u044b \u0441\u0430\u043c\u0438\u043c OpenDAL?<\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0435\u0440\u0435\u0437\u00a0<code>std::fs<\/code> rust:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/rust-std-fs-read\/src\/main.rs\" rel=\"noopener noreferrer nofollow\">rust-std-fs-read<\/a>:<\/p>\n<pre><code class=\"rust\">use std::io::Read; use std::fs::OpenOptions;  fn main() {     let mut bs = vec![0; 64 * 1024 * 1024];     let mut f = OpenOptions::new().read(true).open(\"\/tmp\/file\").unwrap();     let mut ts = 0;     loop {         let buf = &amp;mut bs[ts..];         let n = f.read(buf).unwrap();         let n = n as usize;         if n == 0 {             break         }         ts += n;     }      assert_eq!(ts, 64 * 1024 * 1024); } <\/code><\/pre>\n<p>\u041d\u043e&#8230;<\/p>\n<pre><code>Benchmark 1: rust-std-fs-read\/target\/release\/test   Time (mean \u00b1 \u03c3):      23.1 ms \u00b1   2.5 ms    [User: 0.3 ms, System: 22.8 ms]   Range (min \u2026 max):    21.0 ms \u2026  37.6 ms    124 runs   Benchmark 2: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.2 ms \u00b1   1.1 ms    [User: 5.4 ms, System: 9.7 ms]   Range (min \u2026 max):    14.3 ms \u2026  21.4 ms    178 runs  Summary   python-fs-read\/test.py ran     1.52 \u00b1 0.20 times faster than rust-std-fs-read\/target\/release\/test <\/code><\/pre>\n<p>\u041e\u0433\u043e, std fs Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python? \u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e?<\/p>\n<h3>std fs Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python? \u0421\u0435\u0440\u044c\u0451\u0437\u043d\u043e?!<\/h3>\n<p>\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c: std fs rust \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python.<\/p>\n<p>\u042f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0441\u044f, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>strace<\/code>\u00a0\u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432.\u00a0<code>strace<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0434\u043b\u044f Linux, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b.<\/p>\n<p>strace \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u041d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u043f\u0435\u043a\u0442\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441<code>\/tmp\/file<\/code>. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 strace \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0438\u043c\u0435\u043d\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0434\u0443\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u044b\u0432\u043e\u0434.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>openat<\/code>\u00a0, \u0443\u043a\u0430\u0437\u0430\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b <code>AT_FDCWD<\/code>,\u00a0<code>\"\/tmp\/file\"<\/code> \u0438\u00a0<code>O_RDONLY|O_CLOEXEC<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434 <code>3<\/code> \u2014 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435.<\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u044b \u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0435 \u043e\u0441\u0432\u043e\u0438\u043b\u0438 <code>strace<\/code>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c!<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b strace \u0434\u043b\u044f <code>rust-std-fs-read<\/code>:<\/p>\n<pre><code>> strace .\/rust-std-fs-read\/target\/release\/test ... mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f290dd40000 openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3 read(3, \"\\tP\\201A\\225\\366>\\260\\270R\\365\\313\\220{E\\372\\274\\6\\35\\\"\\353\\204\\220s\\2|7C\\205\\265\\6\\263\"..., 67108864) = 67108864 read(3, \"\", 0)                          = 0 close(3)                                = 0 munmap(0x7f290dd40000, 67112960)        = 0 ...<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b strace \u0434\u043b\u044f <code>python-fs-read<\/code>:<\/p>\n<pre><code>> strace .\/python-fs-read\/test.py ... openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, \"\", {st_mode=S_IFREG|0644, st_size=67108864, ...}, AT_EMPTY_PATH) = 0 ioctl(3, TCGETS, 0x7ffe9f844ac0)        = -1 ENOTTY (Inappropriate ioctl for device) lseek(3, 0, SEEK_CUR)                   = 0 lseek(3, 0, SEEK_CUR)                   = 0 newfstatat(3, \"\", {st_mode=S_IFREG|0644, st_size=67108864, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13277ff000 read(3, \"\\tP\\201A\\225\\366>\\260\\270R\\365\\313\\220{E\\372\\274\\6\\35\\\"\\353\\204\\220s\\2|7C\\205\\265\\6\\263\"..., 67108865) = 67108864 read(3, \"\", 1)                          = 0 close(3)                                = 0 rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK, sa_restorer=0x7f132be5c710}, {sa_handler=0x7f132c17ac36, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK, sa_restorer=0x7f132be5c710}, 8) = 0 munmap(0x7f13277ff000, 67112960)        = 0 ...<\/code><\/pre>\n<p>\u0418\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 strace \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432 <code>python-fs-read<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0447\u0435\u043c \u0432 <code>rust-std-fs-read<\/code>, \u0438 \u043e\u0431\u0430 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>mmap<\/code>. \u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 python \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c rust?<\/p>\n<h4>\u0417\u0430\u0447\u0435\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0437\u0434\u0435\u0441\u044c mmap?<\/h4>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e <code>mmap<\/code>\u00a0\u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u043c\u044f\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e <code>mmap<\/code>\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0438\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0427\u0430\u0441\u0442\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 strace:<\/p>\n<pre><code>mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13277ff000<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p><code>NULL<\/code>: \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.\u00a0<code>NULL<\/code>\u00a0\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0430\u043c\u043e\u0439 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441.<\/p>\n<\/li>\n<li>\n<p><code>67112960<\/code>: \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c 64 \u041c\u0438\u0411 + 4 \u041a\u0438\u0411 \u043f\u0430\u043c\u044f\u0442\u0438, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><code>PROT_READ|PROT_WRITE<\/code>: \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p><code>MAP_PRIVATE|MAP_ANONYMOUS<\/code>:<\/p>\n<ul>\n<li>\n<p><code>MAP_PRIVATE<\/code>\u00a0\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0438\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0445 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0442\u0443 \u0436\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b (\u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0441\u0442\u044c).<\/p>\n<\/li>\n<li>\n<p><code>MAP_ANONYMOUS<\/code>\u00a0\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u0444\u0430\u0439\u043b\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>-1<\/code>: \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c.\u00a0<code>-1<\/code>\u00a0\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p><code>0<\/code>: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d <code>0<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041d\u043e \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e mmap\u00a0\u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u0434\u0435.<\/h4>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432<code>mmap<\/code>\u00a0\u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<code>glibc<\/code>. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>malloc<\/code>\u00a0\u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0430 \u0432 \u043e\u0442\u0432\u0435\u0442\u00a0<code>glibc<\/code>\u00a0\u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b <code>brk<\/code>\u00a0\u0438 <code>mmap<\/code>\u00a0\u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0443. \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u043b\u0438\u043a, \u0442\u043e <code>glibc<\/code>\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 <code>mmap<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 Rust, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u0434 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 <code>x86_64-unknown-linux-gnu<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>malloc<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e <code>glibc<\/code>.<\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438 Python \u0442\u043e\u0442 \u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e \u0438 Rust?<\/h4>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Python \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>pymalloc<\/code> \u2014 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. Python \u0438\u043c\u0435\u0435\u0442 \u0442\u0440\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u0446\u0435\u043b\u0438.<\/p>\n<p><code>pymalloc<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<blockquote>\n<p>\u0423 Python \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c<code>pymalloc<\/code>\u00a0, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u043c\u0435\u043b\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b (\u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u044b\u0435 512 \u0431\u0430\u0439\u0442\u0430\u043c) \u0441 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0436\u0438\u0437\u043d\u0438. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u00ab\u0430\u0440\u0435\u043d\u0430\u043c\u0438\u00bb (arena) c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 256 \u041a\u0438\u0411 (\u043d\u0430 32-\u0431\u0438\u0442\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445) \u0438\u043b\u0438 1 \u041c\u0438\u0411 \u043d\u0430 64-\u0431\u0438\u0442\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445. \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 512 \u0431\u0430\u0439\u0442\u043e\u0432, \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e PyMem_RawMalloc() \u0438 PyMem_RawRealloc().<\/p>\n<\/blockquote>\n<h3>Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438?<\/h3>\n<p>\u042f \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 <code>mmap<\/code>. \u0427\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043d\u0430 <code>jemalloc<\/code>?<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/rust-std-fs-read-with-jemalloc\/src\/main.rs\" rel=\"noopener noreferrer nofollow\">rust-std-fs-read-with-jemalloc<\/a>:<\/p>\n<pre><code class=\"rust\">use std::io::Read; use std::fs::OpenOptions;  #[global_allocator] static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;  fn main() {     let mut bs = vec![0; 64 * 1024 * 1024];     let mut f = OpenOptions::new().read(true).open(\"\/tmp\/file\").unwrap();     let mut ts = 0;     loop {         let buf = &amp;mut bs[ts..];         let n = f.read(buf).unwrap();         let n = n as usize;         if n == 0 {             break         }         ts += n;     }      assert_eq!(ts, 64 * 1024 * 1024); } <\/code><\/pre>\n<p>\u041e\u0433\u043e-\u043e-\u043e!<\/p>\n<pre><code>Benchmark 1: rust-std-fs-read-with-jemalloc\/target\/release\/test   Time (mean \u00b1 \u03c3):       9.7 ms \u00b1   0.6 ms    [User: 0.3 ms, System: 9.4 ms]   Range (min \u2026 max):     9.0 ms \u2026  12.4 ms    259 runs   Benchmark 2: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.8 ms \u00b1   0.9 ms    [User: 5.9 ms, System: 9.8 ms]   Range (min \u2026 max):    15.0 ms \u2026  21.8 ms    169 runs  Summary   rust-std-fs-read-with-jemalloc\/target\/release\/test ran     1.64 \u00b1 0.14 times faster than python-fs-read\/test.py <\/code><\/pre>\n<p>\u0427\u0442\u043e?! \u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e <code>jemalloc<\/code>\u00a0\u2014 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u043e \u043a\u0430\u043a \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u043c? \u042d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e.<\/p>\n<h3>Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435!<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043b\u0438\u0441\u044c \u043c\u043e\u0438 \u0434\u0440\u0443\u0437\u044c\u044f, \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e Rust \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<p>\u041c\u043e\u0439 CPU:<\/p>\n<pre><code>> lscpu Architecture:            x86_64   CPU op-mode(s):        32-bit, 64-bit   Address sizes:         48 bits physical, 48 bits virtual   Byte Order:            Little Endian CPU(s):                  32   On-line CPU(s) list:   0-31 Vendor ID:               AuthenticAMD   Model name:            AMD Ryzen 9 5950X 16-Core Processor     CPU family:          25     Model:               33     Thread(s) per core:  2     Core(s) per socket:  16     Socket(s):           1     Stepping:            0     Frequency boost:     enabled     CPU(s) scaling MHz:  53%     CPU max MHz:         5083.3979     CPU min MHz:         2200.0000     BogoMIPS:            6787.49     Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm con                          stant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f                          16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpex                          t perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap                           clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk clzero irperf xsaveerptr rdpru wb                          noinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl                          umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm debug_swap Virtualization features:   Virtualization:        AMD-V Caches (sum of all):   L1d:                   512 KiB (16 instances)   L1i:                   512 KiB (16 instances)   L2:                    8 MiB (16 instances)   L3:                    64 MiB (2 instances) NUMA:   NUMA node(s):          1   NUMA node0 CPU(s):     0-31 Vulnerabilities:   Gather data sampling:  Not affected   Itlb multihit:         Not affected   L1tf:                  Not affected   Mds:                   Not affected   Meltdown:              Not affected   Mmio stale data:       Not affected   Retbleed:              Not affected   Spec rstack overflow:  Vulnerable   Spec store bypass:     Vulnerable   Spectre v1:            Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers   Spectre v2:            Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Not affected   Srbds:                 Not affected   Tsx async abort:       Not affected<\/code><\/pre>\n<p>\u041c\u043e\u044f \u043f\u0430\u043c\u044f\u0442\u044c:<\/p>\n<pre><code>> sudo dmidecode --type memory # dmidecode 3.5 Getting SMBIOS data from sysfs. SMBIOS 3.3.0 present.  Handle 0x0014, DMI type 16, 23 bytes Physical Memory Array         Location: System Board Or Motherboard         Use: System Memory         Error Correction Type: None         Maximum Capacity: 64 GB         Error Information Handle: 0x0013         Number Of Devices: 4  Handle 0x001C, DMI type 17, 92 bytes Memory Device         Array Handle: 0x0014         Error Information Handle: 0x001B         Total Width: 64 bits         Data Width: 64 bits         Size: 16 GB         Form Factor: DIMM         Set: None         Locator: DIMM 0         Bank Locator: P0 CHANNEL A         Type: DDR4         Type Detail: Synchronous Unbuffered (Unregistered)         Speed: 3200 MT\/s         Manufacturer: Unknown         Serial Number: 04904740         Asset Tag: Not Specified         Part Number: LMKUFG68AHFHD-32A         Rank: 2         Configured Memory Speed: 3200 MT\/s         Minimum Voltage: 1.2 V         Maximum Voltage: 1.2 V         Configured Voltage: 1.2 V         Memory Technology: DRAM         Memory Operating Mode Capability: Volatile memory         Firmware Version: Unknown         Module Manufacturer ID: Bank 9, Hex 0xC8         Module Product ID: Unknown         Memory Subsystem Controller Manufacturer ID: Unknown         Memory Subsystem Controller Product ID: Unknown         Non-Volatile Size: None         Volatile Size: 16 GB         Cache Size: None         Logical Size: None <\/code><\/pre>\n<p>\u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<h4>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0440 \u0437\u0430\u0449\u0438\u0442\u044b<\/h4>\n<p>\u0412 CPU \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0445 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435; \u0441\u0430\u043c\u0430\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e <code>Spectre<\/code>. \u0414\u043b\u044f \u044f\u0434\u0440\u0430 Linux \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0440 \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043b\u044f \u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u044d\u0442\u0438\u043c\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438, \u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u0438 \u043c\u0435\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f\u0434\u0440\u043e Linux \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u043c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0444\u043b\u0430\u0433 <code>mitigations<\/code>.<\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u043b \u0432\u0441\u0435 <code>mitigations<\/code>\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>title Arch Linux linux \/vmlinuz-linux-zen initrd \/amd-ucode.img initrd \/initramfs-linux-zen.img options root=\"PARTUUID=206e7750-2b89-419d-978e-db0068c79c52\" rw mitigations=off <\/code><\/pre>\n<p>\u0418\u0445 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Transparent Hugepage<\/h4>\n<p><a href=\"https:\/\/www.kernel.org\/doc\/html\/next\/admin-guide\/mm\/transhuge.html\" rel=\"noopener noreferrer nofollow\">Transparent Hugepage<\/a>\u00a0\u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u044d\u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code>> cat \/sys\/kernel\/mm\/transparent_hugepage\/enabled [always] madvise never <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 <code>madvise<\/code>\u00a0\u0438\u043b\u0438 <code>never<\/code>\u00a0\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 CPU Core Affinity<\/h4>\n<p><a href=\"https:\/\/github.com\/ZheaoLi\" rel=\"noopener noreferrer nofollow\">@Manjusaka<\/a>\u00a0\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 <code>CPU Core Spacing<\/code>.<\/p>\n<p>\u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/docs.rs\/core_affinity\/latest\/core_affinity\/\" rel=\"noopener noreferrer nofollow\">core_affinity<\/a>\u00a0, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 CPU, \u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435.<\/p>\n<h4>\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 eBPF<\/h4>\n<p><a href=\"https:\/\/github.com\/ZheaoLi\" rel=\"noopener noreferrer nofollow\">@Manjusaka<\/a>\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0434\u043b\u044f \u043c\u0435\u043d\u044f <a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/scripts\/read-latency.py\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 eBPF<\/a>, \u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0449\u0443\u044e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f. \u0418\u0437 \u0435\u0451 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python \u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432.<\/p>\n<blockquote>\n<p>\u041e\u0431 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 eBPF \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e @Manjusaka \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435!<\/p>\n<\/blockquote>\n<pre><code># python fs read Process 57555 read file 8134049 ns Process 57555 read file 942 ns  # rust std fs read Process 57634 read file 24636975 ns Process 57634 read file 1052 ns<\/code><\/pre>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435: \u043d\u0430 \u043c\u043e\u0451\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 Rust \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python \u0438, \u043f\u043e\u0445\u043e\u0436\u0435, \u044d\u0442\u043e \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u041f\u041e.<\/p>\n<h3>C \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p>\u042f \u0437\u0430\u0448\u0451\u043b \u0432 \u0442\u0443\u043f\u0438\u043a \u0438 \u043d\u0435 \u043c\u043e\u0433 \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0447\u0451\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430. \u041f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e, \u044d\u0442\u043e \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 CPU, \u043d\u043e \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0432 \u043a\u0430\u043a\u043e\u043c \u0430\u0441\u043f\u0435\u043a\u0442\u0435: \u043a\u044d\u0448? \u0447\u0430\u0441\u0442\u043e\u0442\u0430? core spacing? core affinity? \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430?<\/p>\n<p>\u041f\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c \u0438\u0437 Telegram-\u0433\u0440\u0443\u043f\u043f\u044b <a href=\"https:\/\/t.me\/rust_zh\" rel=\"noopener noreferrer nofollow\">@rust_zh<\/a> \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432\u0435\u0440\u0441\u0438\u044e \u043d\u0430 C:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/c-fs-read\/test.c\" rel=\"noopener noreferrer nofollow\">c-fs-read<\/a>:<\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h> #include &lt;stdlib.h>  #define FILE_SIZE 64 * 1024 * 1024  \/\/ 64 MiB  int main() {     FILE *file;     char *buffer;     size_t result;      file = fopen(\"\/tmp\/file\", \"rb\");     if (file == NULL) {         fputs(\"Error opening file\", stderr);         return 1;     }      buffer = (char *)malloc(sizeof(char) * FILE_SIZE);     if (buffer == NULL) {         fputs(\"Memory error\", stderr);         fclose(file);         return 2;     }      result = fread(buffer, 1, FILE_SIZE, file);     if (result != FILE_SIZE) {         fputs(\"Reading error\", stderr);         fclose(file);         free(buffer);         return 3;     }      fclose(file);     free(buffer);      return 0; }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e&#8230;<\/p>\n<pre><code>Benchmark 1: c-fs-read\/test   Time (mean \u00b1 \u03c3):      23.8 ms \u00b1   0.9 ms    [User: 0.3 ms, System: 23.6 ms]   Range (min \u2026 max):    23.0 ms \u2026  27.1 ms    120 runs  Benchmark 2: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      19.1 ms \u00b1   0.3 ms    [User: 8.6 ms, System: 10.4 ms]   Range (min \u2026 max):    18.6 ms \u2026  20.6 ms    146 runs  Summary   python-fs-read\/test.py ran     1.25 \u00b1 0.05 times faster than c-fs-read\/test <\/code><\/pre>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430 C \u0442\u043e\u0436\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u043d\u0430 Python! \u0423 Python \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043c\u0430\u0433\u0438\u044f?<\/p>\n<h3>C \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f!<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043b\u0441\u044f\u00a0<a href=\"https:\/\/github.com\/lilydjwg\" rel=\"noopener noreferrer nofollow\">@lilydjwg<\/a>\u00a0\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u043b \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 C \u0438 Python.<\/p>\n<blockquote>\n<p>\u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0435\u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>strace -e raw=read,mmap .\/program<\/code>\u00a0: \u0430\u0434\u0440\u0435\u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/blockquote>\n<p>strace \u0434\u043b\u044f<code>c-fs-read<\/code>:<\/p>\n<pre><code>> strace -e raw=read,mmap .\/c-fs-read\/test ... mmap(0, 0x4001000, 0x3, 0x22, 0xffffffff, 0) = 0x7f96d1a18000 read(0x3, 0x7f96d1a18010, 0x4000000)    = 0x4000000 close(3)                                = 0<\/code><\/pre>\n<p>strace \u0434\u043b\u044f\u00a0<code>python-fs-read<\/code><\/p>\n<pre><code>> strace -e raw=read,mmap .\/python-fs-read\/test.py ... mmap(0, 0x4001000, 0x3, 0x22, 0xffffffff, 0) = 0x7f27dcfbe000 read(0x3, 0x7f27dcfbe030, 0x4000001)    = 0x4000000 read(0x3, 0x7f27e0fbe030, 0x1)          = 0 close(3)                                = 0<\/code><\/pre>\n<p>\u0412<code>c-fs-read<\/code>\u00a0<code>mmap<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>0x7f96d1a18000<\/code>, \u043d\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430<code>0x7f96d1a18010<\/code>\u00a0, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e <code>0x10<\/code>. \u0412 <code>python-fs-read<\/code>\u00a0<code>mmap<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<code>0x7f27dcfbe000<\/code>, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 <code>0x7f27dcfbe030<\/code>, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e <code>0x30<\/code>.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 <a href=\"https:\/\/github.com\/lilydjwg\" rel=\"noopener noreferrer nofollow\">@lilydjwg<\/a>\u00a0\u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>read<\/code>\u00a0\u0441 \u0442\u0435\u043c \u0436\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code>:) .\/bench c-fs-read c-fs-read-with-offset python-fs-read ['hyperfine', 'c-fs-read\/test', 'c-fs-read-with-offset\/test', 'python-fs-read\/test.py'] Benchmark 1: c-fs-read\/test   Time (mean \u00b1 \u03c3):      23.7 ms \u00b1   0.8 ms    [User: 0.2 ms, System: 23.6 ms]   Range (min \u2026 max):    23.0 ms \u2026  25.5 ms    119 runs    Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.  Benchmark 2: c-fs-read-with-offset\/test   Time (mean \u00b1 \u03c3):       8.9 ms \u00b1   0.4 ms    [User: 0.2 ms, System: 8.8 ms]   Range (min \u2026 max):     8.3 ms \u2026  10.6 ms    283 runs  Benchmark 3: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      19.1 ms \u00b1   0.3 ms    [User: 8.6 ms, System: 10.4 ms]   Range (min \u2026 max):    18.6 ms \u2026  20.0 ms    147 runs  Summary   c-fs-read-with-offset\/test ran     2.15 \u00b1 0.11 times faster than python-fs-read\/test.py     2.68 \u00b1 0.16 times faster than c-fs-read\/test<\/code><\/pre>\n<p>!!!<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a <code>buffer<\/code>\u00a0\u0432 <code>c-fs-read<\/code>\u00a0, \u043c\u044b \u043f\u043e\u0432\u044b\u0441\u0438\u043b\u0438 \u0435\u0433\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u043e\u0431\u043e\u0433\u043d\u0430\u0432 Python! \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u043d\u0430<code>AMD Ryzen 9 5900X<\/code>, \u0438 \u043d\u0430 <code>AMD Ryzen 7 5700X<\/code>.<\/p>\n<p>\u041d\u043e\u0432\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u043b\u0430 \u043c\u0435\u043d\u044f \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u043e\u0442\u0447\u0451\u0442\u0430\u043c \u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435:\u00a0<a href=\"https:\/\/users.rust-lang.org\/t\/std-read-slow\/85424\" rel=\"noopener noreferrer nofollow\">Std::fs::read slow?<\/a> \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 <a href=\"https:\/\/github.com\/ambiso\" rel=\"noopener noreferrer nofollow\">@ambiso<\/a>\u00a0\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e CPU \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442\u0441\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 <code>0x10<\/code>\u00a0\u0431\u0430\u0439\u0442\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b:<\/p>\n<pre><code>offset milliseconds  ...  14   130  15   130  16    46   &lt;----- 0x10!  17    48  ...<\/code><\/pre>\n<h3>AMD Ryzen 9 5900X \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f!<\/h3>\n<p>\u041c\u044b \u0434\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 CPU, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0447\u0438\u043d.\u00a0<a href=\"https:\/\/github.com\/ZheaoLi\" rel=\"noopener noreferrer nofollow\">@Manjusaka<\/a>\u00a0\u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u043b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u044f\u0434\u0440\u0430 <a href=\"https:\/\/github.com\/ryncsn\" rel=\"noopener noreferrer nofollow\">@ryncsn<\/a>.<\/p>\n<p>\u041e\u043d \u0441\u043c\u043e\u0433 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0434\u0435\u043c\u043e <code>c-fs-read<\/code>\u00a0\u0438 <code>c-fs-read-with-offset<\/code>\u00a0\u043d\u0430 <code>AMD Ryzen 9 5900HX<\/code>. \u0422\u0430\u043a\u0436\u0435 \u043e\u043d \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>perf<\/code>.<\/p>\n<p>\u0411\u0435\u0437 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>perf stat -d -d -d --repeat 20 .\/a.out  Performance counter stats for '.\/a.out' (20 runs):               30.89 msec task-clock                       #    0.968 CPUs utilized               ( +-  1.35% )                  0      context-switches                 #    0.000 \/sec                  0      cpu-migrations                   #    0.000 \/sec                598      page-faults                      #   19.362 K\/sec                       ( +-  0.05% )         90,321,344      cycles                           #    2.924 GHz                         ( +-  1.12% )  (40.76%)            599,640      stalled-cycles-frontend          #    0.66% frontend cycles idle        ( +-  2.19% )  (42.11%)            398,016      stalled-cycles-backend           #    0.44% backend cycles idle         ( +- 22.41% )  (41.88%)         43,349,705      instructions                     #    0.48  insn per cycle                                                   #    0.01  stalled cycles per insn     ( +-  1.32% )  (41.91%)          7,526,819      branches                         #  243.701 M\/sec                       ( +-  5.01% )  (41.22%)             37,541      branch-misses                    #    0.50% of all branches             ( +-  4.62% )  (41.12%)        127,845,213      L1-dcache-loads                  #    4.139 G\/sec                       ( +-  1.14% )  (39.84%)          3,172,628      L1-dcache-load-misses            #    2.48% of all L1-dcache accesses   ( +-  1.34% )  (38.46%)    &lt;not supported>      LLC-loads    &lt;not supported>      LLC-load-misses            654,651      L1-icache-loads                  #   21.196 M\/sec                       ( +-  1.71% )  (38.72%)              2,828      L1-icache-load-misses            #    0.43% of all L1-icache accesses   ( +-  2.35% )  (38.67%)             15,615      dTLB-loads                       #  505.578 K\/sec                       ( +-  1.28% )  (38.82%)             12,825      dTLB-load-misses                 #   82.13% of all dTLB cache accesses  ( +-  1.15% )  (38.88%)                 16      iTLB-loads                       #  518.043 \/sec                        ( +- 27.06% )  (38.82%)              2,202      iTLB-load-misses                 # 13762.50% of all iTLB cache accesses  ( +- 23.62% )  (39.38%)          1,843,493      L1-dcache-prefetches             #   59.688 M\/sec                       ( +-  3.36% )  (39.40%)    &lt;not supported>      L1-dcache-prefetch-misses            0.031915 +- 0.000419 seconds time elapsed  ( +-  1.31% )<\/code><\/pre>\n<p>\u0421\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code>perf stat -d -d -d --repeat 20 .\/a.out  Performance counter stats for '.\/a.out' (20 runs):               15.39 msec task-clock                       #    0.937 CPUs utilized               ( +-  3.24% )                  1      context-switches                 #   64.972 \/sec                        ( +- 17.62% )                  0      cpu-migrations                   #    0.000 \/sec                598      page-faults                      #   38.854 K\/sec                       ( +-  0.06% )         41,239,117      cycles                           #    2.679 GHz                         ( +-  1.95% )  (40.68%)            547,465      stalled-cycles-frontend          #    1.33% frontend cycles idle        ( +-  3.43% )  (40.60%)            413,657      stalled-cycles-backend           #    1.00% backend cycles idle         ( +- 20.37% )  (40.50%)         37,009,429      instructions                     #    0.90  insn per cycle                                                   #    0.01  stalled cycles per insn     ( +-  3.13% )  (40.43%)          5,410,381      branches                         #  351.526 M\/sec                       ( +-  3.24% )  (39.80%)             34,649      branch-misses                    #    0.64% of all branches             ( +-  4.04% )  (39.94%)         13,965,813      L1-dcache-loads                  #  907.393 M\/sec                       ( +-  3.37% )  (39.44%)          3,623,350      L1-dcache-load-misses            #   25.94% of all L1-dcache accesses   ( +-  3.56% )  (39.52%)    &lt;not supported>      LLC-loads    &lt;not supported>      LLC-load-misses            590,613      L1-icache-loads                  #   38.374 M\/sec                       ( +-  3.39% )  (39.67%)              1,995      L1-icache-load-misses            #    0.34% of all L1-icache accesses   ( +-  4.18% )  (39.67%)             16,046      dTLB-loads                       #    1.043 M\/sec                       ( +-  3.28% )  (39.78%)             14,040      dTLB-load-misses                 #   87.50% of all dTLB cache accesses  ( +-  3.24% )  (39.78%)                 11      iTLB-loads                       #  714.697 \/sec                        ( +- 29.56% )  (39.77%)              3,657      iTLB-load-misses                 # 33245.45% of all iTLB cache accesses  ( +- 14.61% )  (40.30%)            395,578      L1-dcache-prefetches             #   25.702 M\/sec                       ( +-  3.34% )  (40.10%)    &lt;not supported>      L1-dcache-prefetch-misses            0.016429 +- 0.000521 seconds time elapsed  ( +-  3.17% )<\/code><\/pre>\n<p>\u041e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>L1-dcache-prefetches<\/code>\u00a0\u0438 <code>L1-dcache-loads<\/code>\u00a0\u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<ul>\n<li>\n<p><code>L1-dcache-prefetches<\/code>\u00a0\u2014 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u043a\u044d\u0448\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 L1 CPU.<\/p>\n<\/li>\n<li>\n<p><code>L1-dcache-loads<\/code>\u00a0\u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u044d\u0448\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 L1 CPU.<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f CPU \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0441 \u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c <code>L1-dcache<\/code>, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432.<\/p>\n<p>\u041e\u043d \u043f\u0440\u043e\u0432\u0451\u043b \u0443\u0433\u043b\u0443\u0431\u043b\u0451\u043d\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u044f\u0447\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 ASM:<\/p>\n<pre><code>Samples: 15K of event 'cycles:P', Event count (approx.): 6078132137   Children      Self  Command    Shared Object         Symbol -   94.11%     0.00%  a.out      [kernel.vmlinux]      [k] entry_SYSCALL_64_after_hwframe                                                                                                                        \u25c6    - entry_SYSCALL_64_after_hwframe                                                                                                                                                                              \u2592       - 94.10% do_syscall_64                                                                                                                                                                                     \u2592          - 86.66% __x64_sys_read                                                                                                                                                                                 \u2592               ksys_read                                                                                                                                                                                          \u2592             - vfs_read                                                                                                                                                                                           \u2592                - 85.94% shmem_file_read_iter                                                                                                                                                                     \u2592                   - 77.17% copy_page_to_iter                                                                                                                                                                     \u2592                      - 75.80% _copy_to_iter                                                                                                                                                                      \u2592                         + 19.41% asm_exc_page_fault                                                                                                                                                              \u2592                        0.71% __might_fault                                                                                                                                                                       \u2592                   + 4.87% shmem_get_folio_gfp                                                                                                                                                                    \u2592                     0.76% folio_mark_accessed                                                                                                                                                                    \u2592          + 4.38% __x64_sys_munmap                                                                                                                                                                                \u2592          + 1.02% 0xffffffffae6f6fe8                                                                                                                                                                              \u2592          + 0.79% __x64_sys_execve                                                                                                                                                                                \u2592          + 0.58% __x64_sys_mmap                                                                                                                                                                                  \u2592 <\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438<code>_copy_to_iter<\/code> ASM \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>       \u2502     copy_user_generic():   2.19 \u2502       mov    %rdx,%rcx        \u2502       mov    %r12,%rsi  92.45 \u2502       rep    movsb %ds:(%rsi),%es:(%rdi)   0.49 \u2502       nop        \u2502       nop        \u2502       nop <\/code><\/pre>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0437\u0434\u0435\u0441\u044c \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>rep movsb<\/code>.<\/p>\n<h3>AMD Ryzen 9 5900X \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 FSRM!<\/h3>\n<p>\u0412 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043e\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u043c\u043d\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043e\u0431 <a href=\"https:\/\/bugs.launchpad.net\/ubuntu\/+source\/glibc\/+bug\/2030515\" rel=\"noopener noreferrer nofollow\">\u0443\u0436\u0430\u0441\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 memcpy \u043d\u0430 Zen 3 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 rep movsb<\/a>. \u0412 \u043d\u0435\u0439 \u0442\u043e\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0430\u0441\u044c <code>rep movsb<\/code>:<\/p>\n<blockquote>\n<p>\u042f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 memcpy <a href=\"https:\/\/github.com\/ska-sa\/katgpucbf\/blob\/69752be58fb8ab0668ada806e0fd809e782cc58b\/scratch\/memcpy_loop.cpp\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/ska-sa\/katgpucbf\/blob\/69752be58fb8ab0668ada806e0fd809e782cc58b\/scratch\/memcpy_loop.cpp<\/a>\u00a0(\u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u0442\u0430\u043c \u0436\u0435 Makefile). \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435<\/p>\n<p>.\/memcpy_loop -b 2113 -p 1000000 -t mmap -S 0 -D 1 0<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>2113-\u0431\u0430\u0439\u0442\u043d\u044b\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>1000000 \u0440\u0430\u0437 \u0437\u0430 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 mmap<\/p>\n<\/li>\n<li>\n<p>\u0441 0 \u0431\u0430\u0439\u0442\u0430\u043c\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/p>\n<\/li>\n<li>\n<p>\u0441 1 \u0431\u0430\u0439\u0442\u043e\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u0442\u0430 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/p>\n<\/li>\n<li>\n<p>\u0432 \u044f\u0434\u0440\u0435 0.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 3,2 \u0413\u0411\/\u0441. \u0415\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 2111, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 100 \u0413\u0411\/\u0441. \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 REP MOVSB \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044c \u0440\u0430\u0437 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435!<\/p>\n<\/blockquote>\n<p><code>FSRM<\/code> (<code>Fast Short REP MOV)<\/code> \u2014 \u044d\u0442\u043e \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u044f Intel, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u0451\u043d\u043d\u0430\u044f \u0438 \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b AMD; \u043e\u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c <code>rep movsb<\/code>\u00a0\u0438 <code>rep movsd<\/code>. \u041e\u043d\u0430 \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0451\u043c\u043e\u0432 \u043f\u0430\u043c\u044f\u0442\u0438. CPU, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0430 \u0435\u0451 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>glibc<\/code> \u0432 <code>FSRM<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/ryncsn\" rel=\"noopener noreferrer nofollow\">@ryncsn<\/a>\u00a0\u043f\u0440\u043e\u0432\u0451\u043b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\u0438 L1.<\/p>\n<blockquote>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>rep movsb<\/code>\u00a0\u043d\u0438\u0437\u043a\u0430, \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u044b \u043f\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c, \u0438 \u043e\u043d\u0430 \u0432\u044b\u0448\u0435, \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u044b \u043f\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u0431\u0430\u0432\u043d\u043e&#8230;<\/p>\n<\/blockquote>\n<h3>\u0412\u044b\u0432\u043e\u0434<\/h3>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u041f\u041econclusion. Python \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 C\/Rust \u0438\u0437-\u0437\u0430 \u0431\u0430\u0433\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 AMD. (\u0418 \u044f \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u043e\u0433\u0443 \u0441\u043f\u0430\u0442\u044c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e.)<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430\u0448\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>FSRM<\/code>\u00a0\u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 <code>ucode<\/code>, \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u043d\u0430\u043c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430, \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u0436\u0434\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u0430 AMD. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>FSRM<\/code>\u00a0\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u043b\u0430\u0433 \u0434\u043b\u044f \u0435\u0451 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 Rust \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 <code>jemallocator<\/code>\u00a0\u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u044d\u0442\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u0439 \u0445\u043e\u0434 \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0431\u0430\u0433\u043e\u0432 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 AMD.<\/p>\n<h3>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041d\u0430 \u0440\u0430\u0437\u0431\u043e\u0440 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043f\u043e\u0447\u0442\u0438 \u0442\u0440\u0438 \u0434\u043d\u044f. \u0412\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u0436\u0430\u043b\u043e\u0431 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 <a href=\"https:\/\/github.com\/apache\/incubator-opendal\" rel=\"noopener noreferrer nofollow\">opendal<\/a>\u00a0\u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043c\u0435\u043d\u044f \u043a ucode CPU.<\/p>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u044f \u043c\u043d\u043e\u0433\u043e\u0435 \u0443\u0437\u043d\u0430\u043b \u043e <code>strace<\/code>,\u00a0<code>perf<\/code>\u00a0\u0438 <code>eBPF<\/code>. \u042f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <code>eBPF<\/code>\u00a0\u0434\u043b\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438. \u0422\u0430\u043a\u0436\u0435 \u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0435\u0441\u043f\u043b\u043e\u0434\u043d\u044b\u0445 \u0434\u043e\u0433\u0430\u0434\u043e\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437\u0443\u0447\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<code>std::fs<\/code>\u00a0\u0432 Rust \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0432 Python \u0438 CPython. \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u044f \u043d\u0430\u0434\u0435\u044f\u043b\u0441\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0433\u043b\u0443\u0431\u0436\u0435.<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>@beldathas \u0438\u0437 discord opendal \u0437\u0430 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0435\u00a0<a href=\"https:\/\/github.com\/datafuselabs\" rel=\"noopener noreferrer nofollow\">@datafuselabs<\/a>\u00a0\u0437\u0430 \u0435\u0451 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0448\u0438\u043c \u0434\u0440\u0443\u0437\u044c\u044f\u043c \u0438\u0437 <a href=\"https:\/\/t.me\/rust_zh\" rel=\"noopener noreferrer nofollow\">@rust_zh<\/a>\u00a0<em>(telegram-\u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u043e Rust, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0435\u0434\u0451\u0442\u0441\u044f \u043d\u0430 \u0445\u0430\u043d\u044c\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435)<\/em>\u00a0\u0437\u0430 \u0441\u043e\u0432\u0435\u0442\u044b \u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ZheaoLi\" rel=\"noopener noreferrer nofollow\">@Manjusaka<\/a>\u00a0\u0437\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 eBPF \u0434\u043b\u044f \u0435\u0451 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0441\u0443\u0437\u0438\u0442\u044c \u043a\u0440\u0443\u0433 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/lilydjwg\" rel=\"noopener noreferrer nofollow\">@lilydjwg<\/a>\u00a0\u0437\u0430 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0447\u0438\u043d\u044b: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u00a0<code>0x20<\/code>\u00a0\u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ryncsn\" rel=\"noopener noreferrer nofollow\">@ryncsn<\/a>\u00a0\u0437\u0430 \u0435\u0433\u043e \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0434\u0440\u0443\u0433\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043e FSRM<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\" rel=\"noopener noreferrer nofollow\">Xuanwo\/when-i-find-rust-is-slow<\/a>\u00a0\u2014 \u0432\u0441\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/users.rust-lang.org\/t\/std-read-slow\/85424\" rel=\"noopener noreferrer nofollow\">Std::fs::read slow?<\/a>\u00a0\u2014 \u043e\u0442\u0447\u0451\u0442 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 Rust<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/bugs.launchpad.net\/ubuntu\/+source\/glibc\/+bug\/2030515\" rel=\"noopener noreferrer nofollow\">Terrible memcpy performance on Zen 3 when using rep movsb<\/a>\u00a0\u2014 \u043e\u0442\u0447\u0451\u0442 \u043f\u043e ubuntu glibc<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/apache\/incubator-opendal\/issues\/3665\" rel=\"noopener noreferrer nofollow\">binding\/python: rust std fs is slower than python fs<\/a><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f<\/h3>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f 29 \u043d\u043e\u044f\u0431\u0440\u044f 2023 \u0433\u043e\u0434\u0430, \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435; \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u044f \u0431\u0443\u0434\u0443 \u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u0445.<\/p>\n<h4>1 \u0434\u0435\u043a\u0430\u0431\u0440\u044f 2023 \u0433\u043e\u0434\u0430: \u0437\u043d\u0430\u0435\u0442 \u043b\u0438 AMD \u043e\u0431 \u044d\u0442\u043e\u043c \u0431\u0430\u0433\u0435?<\/h4>\n<p>TL;DR:\u00a0<strong>\u0414\u0430<\/strong><\/p>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, AMD \u0431\u044b\u043b\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0431\u0430\u0433\u0435 \u0435\u0449\u0451 \u0441 2021 \u0433\u043e\u0434\u0430. \u041f\u043e\u0441\u043b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u0432 AMD, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u043e \u043d\u0435\u0439 \u043f\u0440\u043e\u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430.<\/p>\n<p>\u042f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e AMD \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u0437\u044f\u0442\u044c \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u044d\u0442\u043e\u0442 \u0431\u0430\u0433 \u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 <code>amd-ucode<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u0437 \u043d\u0435\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043d\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 <code>amd-ucode<\/code>\u00a0\u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0434\u043b\u044f Zen 3) \u0438\u0437-\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0432 \u043f\u0430\u0442\u0447\u0435. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443, \u043f\u0440\u043e\u0448\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u0435.<\/p>\n<p>\u041d\u0430\u0448\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u2014 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 glibc, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c FSRM. \u041d\u0430 \u044d\u0442\u043e\u043c \u0444\u0440\u043e\u043d\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441:\u00a0<a href=\"https:\/\/inbox.sourceware.org\/libc-alpha\/20231031200925.3297456-3-adhemerval.zanella@linaro.org\/T\/#m4f4458b8b16b0ee2bac1578f0383b10eee2312d8\" rel=\"noopener noreferrer nofollow\">x86: Improve ERMS usage on Zen3<\/a>. \u0421\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h4>1 \u0434\u0435\u043a\u0430\u0431\u0440\u044f 2023 \u0433\u043e\u0434\u0430: jemalloc \u0438\u043b\u0438 pymalloc \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c malloc \u0438\u0437 glibc?<\/h4>\n<p>TL;DR:\u00a0<strong>\u041d\u0435\u0442<\/strong><\/p>\n<p>\u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u044d\u0442\u0438\u043c \u0431\u0430\u0433\u043e\u043c. \u0418\u0437 \u043f\u043e\u0441\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e <code>jemalloc<\/code>\u00a0(<code>pymalloc<\/code>,\u00a0<code>mimalloc<\/code>) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c malloc \u0438\u0437 glibc. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 <code>jemalloc<\/code>\u00a0\u0438 <code>pymalloc<\/code>\u00a0\u043e\u0431\u0433\u043e\u043d\u044f\u044e\u0442 malloc glibc, \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c strace <code>rust-std-fs-read<\/code>\u00a0\u0438 <code>rust-std-fs-read-with-jemalloc<\/code>:<\/p>\n<p>strace \u0434\u043b\u044f <code>rust-std-fs-read<\/code>:<\/p>\n<pre><code>> strace -e raw=read,mmap .\/rust-std-fs-read\/target\/release\/test ... mmap(0, 0x4001000, 0x3, 0x22, 0xffffffff, 0) = 0x7f39a6e49000 openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3 read(0x3, 0x7f39a6e49010, 0x4000000)    = 0x4000000 read(0x3, 0x7f39aae49010, 0)            = 0 close(3)                                = 0<\/code><\/pre>\n<p>strace \u0434\u043b\u044f <code>rust-std-fs-read-with-jemalloc<\/code>:<\/p>\n<pre><code>> strace -e raw=read,mmap .\/rust-std-fs-read-with-jemalloc\/target\/release\/test ... mmap(0, 0x200000, 0x3, 0x4022, 0xffffffff, 0) = 0x7f7a5a400000 mmap(0, 0x5000000, 0x3, 0x4022, 0xffffffff, 0) = 0x7f7a55400000 openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3 read(0x3, 0x7f7a55400740, 0x4000000)    = 0x4000000 read(0x3, 0x7f7a59400740, 0)            = 0 close(3)                                = 0<\/code><\/pre>\n<p>\u0412 <code>rust-std-fs-read<\/code>\u00a0<code>mmap<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>0x7f39a6e49000<\/code>, \u043d\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 <code>0x7f39a6e49010<\/code>, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e <code>0x10<\/code>. \u0412 <code>rust-std-fs-read-with-jemalloc<\/code>\u00a0<code>mmap<\/code>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>0x7f7a55400000<\/code>, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 <code>0x7f7a55400740<\/code>, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e<code>0x740<\/code>.<\/p>\n<p><code>rust-std-fs-read-with-jemalloc<\/code>\u00a0\u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442<code>rust-std-fs-read<\/code>\u00a0\u0438\u0437-\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430:\u00a0<code>0x00..0x10<\/code>\u00a0\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u042d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0438 \u0441 <code>jemalloc<\/code>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/778026\/\"> https:\/\/habr.com\/ru\/articles\/778026\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u0434\u043e\u043b\u0433\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>op.read()<\/code>\u00a0<a href=\"https:\/\/github.com\/apache\/incubator-opendal\" rel=\"noopener noreferrer nofollow\">opendal<\/a>, \u0430 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c. \u042d\u0442\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435. \u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u0432\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044e \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435.<\/p>\n<blockquote>\n<p>\u0412\u0441\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\" rel=\"noopener noreferrer nofollow\">Xuanwo\/when-i-find-rust-is-slow<\/a><\/p>\n<\/blockquote>\n<h3>TL;DR<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0441\u0440\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442, \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0443 \u00ab\u0412\u044b\u0432\u043e\u0434\u00bb.<\/p>\n<h3>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 OpenDAL \u043a Python \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p><a href=\"https:\/\/github.com\/apache\/incubator-opendal\" rel=\"noopener noreferrer nofollow\">OpenDAL<\/a>\u00a0\u2014 \u044d\u0442\u043e \u0441\u043b\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u043b\u044f OpenDAL \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u043a Python \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"https:\/\/github.com\/PyO3\/pyo3\" rel=\"noopener noreferrer nofollow\">pyo3<\/a>.<\/p>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b @beldathas \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u043d\u0435 \u0432 <a href=\"https:\/\/discord.com\/channels\/1081052318650339399\/1174840499576770560\" rel=\"noopener noreferrer nofollow\">discord<\/a>\u00a0\u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 OpenDAL \u043a python \u043c\u0435\u0434\u043b\u0435\u043d\u0435\u0435, \u0447\u0435\u043c python:<\/p>\n<pre><code class=\"python\">import pathlib import timeit  import opendal  root = pathlib.Path(__file__).parent op = opendal.Operator(\"fs\", root=str(root)) filename = \"lorem_ipsum_150mb.txt\"  def read_file_with_opendal() -> bytes:     with op.open(filename, \"rb\") as fp:         result = fp.read()     return result  def read_file_with_normal() -> bytes:     with open(root \/ filename, \"rb\") as fp:         result = fp.read()     return result  if __name__ == \"__main__\":     print(\"normal: \", timeit.timeit(read_file_with_normal, number=100))     print(\"opendal: \", timeit.timeit(read_file_with_opendal, number=100)) <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code>(venv) $ python benchmark.py normal:  4.470868484000675 opendal:  8.993250704006641 <\/code><\/pre>\n<p>\u0422\u0430\u043a-\u0442\u0430\u043a-\u0442\u0430\u043a. \u041c\u0435\u043d\u044f \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043f\u043e\u0440\u0430\u0437\u0438\u043b\u0438 \u044d\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0438\u043f\u043e\u0442\u0435\u0437:<\/p>\n<ul>\n<li>\n<p>\u0423 Python \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043a\u044d\u0448, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043c\u044f\u0442\u044c?<\/p>\n<\/li>\n<li>\n<p>\u0423 Python \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u0440\u044e\u043a, \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0438\u0439 \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432?<\/p>\n<\/li>\n<li>\n<p>\u041b\u0438\u0448\u043d\u044f\u044f \u0442\u0440\u0430\u0442\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 PyO3?<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u043e\u0442\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043b \u043a\u043e\u0434:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/python-fs-read\/test.py\" rel=\"noopener noreferrer nofollow\">python-fs-read<\/a>:<\/p>\n<pre><code class=\"python\">with open(\"\/tmp\/file\", \"rb\") as fp:     result = fp.read() assert len(result) == 64 * 1024 * 1024 <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/python-opendal-read\/test.py\" rel=\"noopener noreferrer nofollow\">python-opendal-read<\/a>:<\/p>\n<pre><code class=\"python\">import opendal  op = opendal.Operator(\"fs\", root=str(\"\/tmp\"))  result = op.read(\"file\") assert len(result) == 64 * 1024 * 1024 <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e python \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 opendal:<\/p>\n<pre><code>Benchmark 1: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.9 ms \u00b1   0.7 ms    [User: 5.6 ms, System: 10.1 ms]   Range (min \u2026 max):    14.9 ms \u2026  21.6 ms    180 runs    Benchmark 2: python-opendal-read\/test.py   Time (mean \u00b1 \u03c3):      32.9 ms \u00b1   1.3 ms    [User: 6.1 ms, System: 26.6 ms]   Range (min \u2026 max):    31.4 ms \u2026  42.6 ms    85 runs    Summary   python-fs-read\/test.py ran     2.07 \u00b1 0.12 times faster than python-opendal-read\/test.py <\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 OpenDAL \u043a Python \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439, \u0447\u0435\u043c \u0441\u0430\u043c Python, \u0438 \u044d\u0442\u043e \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0432 \u0447\u0451\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430.<\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441 OpenDAL Fs \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0430\u0437\u043b\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 rust, opendal, python \u0438 pyo3. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0447\u0438\u043d\u0443.<\/p>\n<p>\u042f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 opendal fs \u043d\u0430 rust:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/rust-opendal-fs-read\/src\/main.rs\" rel=\"noopener noreferrer nofollow\">rust-opendal-fs-read<\/a>:<\/p>\n<pre><code class=\"rust\">use std::io::Read; use opendal::services::Fs; use opendal::Operator;  fn main() {     let mut cfg = Fs::default();     cfg.root(\"\/tmp\");     let op = Operator::new(cfg).unwrap().finish().blocking();      let mut bs = vec![0; 64 * 1024 * 1024];      let mut f = op.reader(\"file\").unwrap();     let mut ts = 0;     loop {         let buf = &amp;mut bs[ts..];         let n = f.read(buf).unwrap();         let n = n as usize;         if n == 0 {             break         }         ts += n;     }      assert_eq!(ts, 64 * 1024 * 1024); } <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e opendal \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c python, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 opendal \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 rust:<\/p>\n<pre><code>Benchmark 1: rust-opendal-fs-read\/target\/release\/test   Time (mean \u00b1 \u03c3):      23.8 ms \u00b1   2.0 ms    [User: 0.4 ms, System: 23.4 ms]   Range (min \u2026 max):    21.8 ms \u2026  34.6 ms    121 runs   Benchmark 2: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.6 ms \u00b1   0.8 ms    [User: 5.5 ms, System: 10.0 ms]   Range (min \u2026 max):    14.4 ms \u2026  20.8 ms    166 runs   Summary   python-fs-read\/test.py ran     1.52 \u00b1 0.15 times faster than rust-opendal-fs-read\/target\/release\/test <\/code><\/pre>\n<p>\u0425\u043e\u0442\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438<code>rust-opendal-fs-read<\/code>\u00a0\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0443 <code>python-opendal-read<\/code>, \u0447\u0442\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0438 pyo3, \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0433\u043b\u0443\u0431\u0436\u0435.<\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 opendal fs \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c python.<\/p>\n<h3>std fs Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python?<\/h3>\n<p>OpenDAL \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 fs \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/doc.rust-lang.org\/std\/fs\/index.html\" rel=\"noopener noreferrer nofollow\">std::fs<\/a>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u0432\u044b\u0437\u0432\u0430\u043d\u044b \u0441\u0430\u043c\u0438\u043c OpenDAL?<\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0435\u0440\u0435\u0437\u00a0<code>std::fs<\/code> rust:<\/p>\n<p><a href=\"https:\/\/github.com\/Xuanwo\/when-i-find-rust-is-slow\/blob\/main\/rust-std-fs-read\/src\/main.rs\" rel=\"noopener noreferrer nofollow\">rust-std-fs-read<\/a>:<\/p>\n<pre><code class=\"rust\">use std::io::Read; use std::fs::OpenOptions;  fn main() {     let mut bs = vec![0; 64 * 1024 * 1024];     let mut f = OpenOptions::new().read(true).open(\"\/tmp\/file\").unwrap();     let mut ts = 0;     loop {         let buf = &amp;mut bs[ts..];         let n = f.read(buf).unwrap();         let n = n as usize;         if n == 0 {             break         }         ts += n;     }      assert_eq!(ts, 64 * 1024 * 1024); } <\/code><\/pre>\n<p>\u041d\u043e&#8230;<\/p>\n<pre><code>Benchmark 1: rust-std-fs-read\/target\/release\/test   Time (mean \u00b1 \u03c3):      23.1 ms \u00b1   2.5 ms    [User: 0.3 ms, System: 22.8 ms]   Range (min \u2026 max):    21.0 ms \u2026  37.6 ms    124 runs   Benchmark 2: python-fs-read\/test.py   Time (mean \u00b1 \u03c3):      15.2 ms \u00b1   1.1 ms    [User: 5.4 ms, System: 9.7 ms]   Range (min \u2026 max):    14.3 ms \u2026  21.4 ms    178 runs  Summary   python-fs-read\/test.py ran     1.52 \u00b1 0.20 times faster than rust-std-fs-read\/target\/release\/test <\/code><\/pre>\n<p>\u041e\u0433\u043e, std fs Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python? \u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e?<\/p>\n<h3>std fs Rust \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python? \u0421\u0435\u0440\u044c\u0451\u0437\u043d\u043e?!<\/h3>\n<p>\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c: std fs rust \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c Python.<\/p>\n<p>\u042f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0441\u044f, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>strace<\/code>\u00a0\u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432.\u00a0<code>strace<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0434\u043b\u044f Linux, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b.<\/p>\n<p>strace \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u041d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u043f\u0435\u043a\u0442\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441<code>\/tmp\/file<\/code>. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 strace \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0438\u043c\u0435\u043d\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0434\u0443\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u044b\u0432\u043e\u0434.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>openat<\/code>\u00a0, \u0443\u043a\u0430\u0437\u0430\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b <code>AT_FDCWD<\/code>,\u00a0<code>\"\/tmp\/file\"<\/code> \u0438\u00a0<code>O_RDONLY|O_CLOEXEC<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434 <code>3<\/code> \u2014 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435.<\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u044b \u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0435 \u043e\u0441\u0432\u043e\u0438\u043b\u0438 <code>strace<\/code>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c!<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b strace \u0434\u043b\u044f <code>rust-std-fs-read<\/code>:<\/p>\n<pre><code>> strace .\/rust-std-fs-read\/target\/release\/test ... mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f290dd40000 openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3 read(3, \"\\tP\\201A\\225\\366>\\260\\270R\\365\\313\\220{E\\372\\274\\6\\35\\\"\\353\\204\\220s\\2|7C\\205\\265\\6\\263\"..., 67108864) = 67108864 read(3, \"\", 0)                          = 0 close(3)                                = 0 munmap(0x7f290dd40000, 67112960)        = 0 ...<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b strace \u0434\u043b\u044f <code>python-fs-read<\/code>:<\/p>\n<pre><code>> strace .\/python-fs-read\/test.py ... openat(AT_FDCWD, \"\/tmp\/file\", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, \"\", {st_mode=S_IFREG|0644, st_size=67108864, ...}, AT_EMPTY_PATH) = 0 ioctl(3, TCGETS, 0x7ffe9f844ac0)        = -1 ENOTTY (Inappropriate ioctl for device) lseek(3, 0, SEEK_CUR)                   = 0 lseek(3, 0, SEEK_CUR)                   = 0 newfstatat(3, \"\", {st_mode=S_IFREG|0644, st_size=67108864, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13277ff000 read(3, \"\\tP\\201A\\225\\366>\\260\\270R\\365\\313\\220{E\\372\\274\\6\\35\\\"\\353\\204\\220s\\2|7C\\205\\265\\6\\263\"..., 67108865) = 67108864 read(3, \"\", 1)                          = 0 close(3)                                = 0 rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK, sa_restorer=0x7f132be5c710}, {sa_handler=0x7f132c17ac36, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK, sa_restorer=0x7f132be5c710}, 8) = 0 munmap(0x7f13277ff000, 67112960)        = 0 ...<\/code><\/pre>\n<p>\u0418\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 strace \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432 <code>python-fs-read<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0447\u0435\u043c \u0432 <code>rust-std-fs-read<\/code>, \u0438 \u043e\u0431\u0430 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>mmap<\/code>. \u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 python \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c rust?<\/p>\n<h4>\u0417\u0430\u0447\u0435\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0437\u0434\u0435\u0441\u044c mmap?<\/h4>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e <code>mmap<\/code>\u00a0\u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u043c\u044f\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e <code>mmap<\/code>\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0438\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0427\u0430\u0441\u0442\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 strace:<\/p>\n<pre><code>mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13277ff000<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p><code>NULL<\/code>: \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.\u00a0<code>NULL<\/code>\u00a0\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0430\u043c\u043e\u0439 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441.<\/p>\n<\/li>\n<li>\n<p><code>67112960<\/code>: \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c 64 \u041c\u0438\u0411 + 4 \u041a\u0438\u0411 \u043f\u0430\u043c\u044f\u0442\u0438, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><code>PROT_READ|PROT_WRITE<\/code>: \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p><code>MAP_PRIVATE|MAP_ANONYMOUS<\/code>:<\/p>\n<ul>\n<li>\n<p><code>MAP_PRIVATE<\/code>\u00a0\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0438\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0445 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0442\u0443 \u0436\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b (\u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0441\u0442\u044c).<\/p>\n<\/li>\n<li>\n<p><code>MAP_ANONYMOUS<\/code>\u00a0\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u0444\u0430\u0439\u043b\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>-1<\/code>: \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c.\u00a0<code>-1<\/code>\u00a0\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p><code>0<\/code>: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d <code>0<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041d\u043e \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e mmap\u00a0\u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u0434\u0435.<\/h4>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432<code>mmap<\/code>\u00a0\u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<code>glibc<\/code>. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>malloc<\/code>\u00a0\u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0430 \u0432 \u043e\u0442\u0432\u0435\u0442\u00a0<code>glibc<\/code>\u00a0\u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b <code>brk<\/code>\u00a0\u0438 <code>mmap<\/code>\u00a0\u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0443. \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u043b\u0438\u043a, \u0442\u043e <code>glibc<\/code>\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 <code>mmap<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 Rust, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u0434 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 <code>x86_64-unknown-linux-gnu<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>malloc<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e <code>glibc<\/code>.<\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438 Python<\/h><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-361848","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/361848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=361848"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/361848\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=361848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=361848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=361848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}