当前位置:首页>python>如何从 Python 调用 Rust

如何从 Python 调用 Rust

  • 2026-06-30 05:36:17
如何从 Python 调用 Rust

在易用性与原始性能之间搭建桥梁的指南。


引言

大多数情况下,Python 已经足够快——尤其是当你依赖 NumPy、Polars 或其他用 C 等编译语言编写的调优库时。但偶尔,你会遇到一个无法向量化的热点循环:也许你在遍历字符串列表进行清理,或者在解析每个字符都很重要的混乱文本。你分析了性能,确认了瓶颈所在,然后盯着一个吃掉一半运行时间的 for 循环。这就是 Rust 大显身手的时刻。

Rust 提供了可预测的性能、对内存的严格控制和无畏并发——而且不需要手动管理内存。如果你想——“又一门要学的语言!”——好消息是你不需要放弃 Python 来使用 Rust。你可以保留你的协调逻辑、笔记本、测试——只将微小的、无聊的内循环移到 Rust 中,将 Rust 的学习曲线降至最低。

本文将演示如何从 Python 调用 Rust,并比较纯 Python 与 Python/Rust 组合的性能差异。


为什么要这样做?

你可能会想:如果我会 Rust,为什么还要与 Python 集成——直接用 Rust 编程不就好了?

原因有三:

1. Rust 并不适合所有场景对于 ML、AI、脚本和 Web 后端等许多系统,Python 已经是首选语言。

2. 大多数代码不是性能关键的对于那些性能关键的部分,你通常只需要 Rust 的一个非常小的子集就能产生实质性影响,所以一点点 Rust 知识可以大有作为。

3. Python 的生态系统难以替代即使你很了解 Rust,Python 也能让你立即使用以下工具:

  • pandas
  • NumPy
  • scikit-learn
  • Jupyter
  • Airflow
  • FastAPI
  • 大量脚本和自动化库

Rust 可能更快,但 Python 在生态系统广度和开发便利性上往往更胜一筹。


Rust 和 Maturin

对于我们的用例,需要两样东西:Rust 和一个名为 maturin 的工具。

大多数人了解 Rust——一种近年来崛起的快速编译语言。但你可能没听说过 maturin

Maturin 是一个用于构建和打包用 Rust 编写的 Python 扩展(使用 PyO3 或 rust-cpython)的工具,主要功能包括:

功能
说明
构建 Python 模块
将 Rust crate 编译成 Python 可以导入的共享库(Windows 上的 .pyd,Linux 上的 .so,macOS 上的 .dylib
打包 wheel 分发包
支持构建适用于 manylinux、macOS 和 Windows 的 wheel 文件
发布到 PyPI
一条命令构建并上传 Rust 扩展
集成到 Python 打包
生成 pyproject.toml,支持 PEP 517,使 pip install 即开即用

设置开发环境

$ uv init pyrust
cd pyrust
$ uv venv pyrust
source pyrust/bin/activate
(pyrust) $

安装 Rust

(pyrust) $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

选择默认安装选项后,验证安装:

(pyrust) $ rustc --version
rustc 1.89.0 (29483883e 2025-08-04)

示例 1 — Hello World 等效示例

创建一个新子文件夹并添加以下三个文件:

Cargo.toml

[package]
name = "hello_rust"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.25", features = ["extension-module"] }

pyproject.toml

[build-system]
requires = ["maturin>=1.5,<2"]
build-backend = "maturin"

[project]
name = "hello_rust"
version = "0.1.0"
requires-python = ">=3.9"

src/lib.rs

use pyo3::prelude::*;

/// 将暴露给 Python 的简单函数
#[pyfunction]
fngreet(name: &str-> PyResult<String> {
Ok(format!("Hello, {} from Rust!", name))
}

/// 模块定义
#[pymodule]
fnhello_rust(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(greet, m)?)?;
Ok(())
}

运行结果:

(pyrust) $ python -c "import hello_rust as hr; print(hr.greet('world'))"

# 输出
Hello, world from Rust!

说明:我们把 Rust 代码放在 src/lib.rs 中是遵循 Rust 惯例,库代码放在此处,而不是 src/main.rs(保留给独立的 Rust 可执行代码)。Maturin + PyO3 会在 src/lib.rs 中查找 #[pymodule] 函数来注册供 Python 调用的 Rust 函数。


示例 2 — Python 循环 vs Rust 循环

考虑一个刻意平凡但具有代表性的场景:你有一个句子列表,需要对它们进行规范化处理——转换为小写、去除标点符号、分词。这很难高效向量化,因为逻辑在每个字符上都有分支。

纯 Python 实现

defprocess_one_py(text: str) -> list[str]:
    word = []
    out = []

for c in text:
if c.isalnum():
            word.append(c.lower())
else:
if word:
                out.append("".join(word))
                word = []

if word:
        out.append("".join(word))

return out

defbatch_process_py(texts: list[str]) -> list[list[str]]:
return [process_one_py(t) for t in texts]

示例:

batch_process_py(["Hello, World! 123""This is a test"])
# 输出:[['hello', 'world', '123'], ['this', 'is', 'a', 'test']]

Rust 等效实现

use pyo3::prelude::*;
use pyo3::wrap_pyfunction;

/// 处理单个字符串:转小写 + 删除标点 + 按空白分割
fnprocess_one(text: &str->Vec<String> {
letmut out = Vec::new();
letmut word = String::new();

forcin text.chars() {
if c.is_alphanumeric() {
            word.push(c.to_ascii_lowercase());
        } elseif c.is_whitespace() {
if !word.is_empty() {
                out.push(std::mem::take(&mut word));
            }
        }
// 完全忽略标点
    }

if !word.is_empty() {
        out.push(word);
    }
    out
}

#[pyfunction]
fnbatch_process(texts: Vec<String>) -> PyResult<Vec<Vec<String>>> {
Ok(texts.iter().map(|t| process_one(t)).collect())
}

#[pymodule]
fnrust_text(_py: Python<'_>, m: &Bound<PyModule>) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(batch_process, m)?)?;
Ok(())
}

编译和基准测试

(pyrust) $ maturin develop --release
(pyrust) $ python benchmark.py

--- Benchmark ---
Python      median: 5.159 s | throughput:  96,919 texts/s
Rust 1-thread median: 3.024 s | throughput: 165,343 texts/s

在处理 500,000 个文本时,Rust 版本比纯 Python 快约 1.7 倍!而且不需要太多额外工作。


示例 3 — 为现有 Rust 代码添加并行性

Rust 有一个名为 Rayon 的并行化库,可以轻松地在多个 CPU 核心间分散代码:

  • 将顺序迭代器 iter() 替换为并行迭代器 par_iter()
  • 自动将数据分块,在 CPU 线程间分配工作,然后合并结果
  • 抽象掉线程管理和同步的复杂性

只需对 Rust 代码做三处微小更改:

use pyo3::prelude::*;
use pyo3::wrap_pyfunction;

// 变更 1:添加这行
use rayon::prelude::*; 

fnprocess_one(text: &str->Vec<String> {
letmut out = Vec::new();
letmut word = String::new();

forcin text.chars() {
if c.is_alphanumeric() {
            word.push(c.to_ascii_lowercase());
        } elseif c.is_whitespace() {
if !word.is_empty() {
                out.push(std::mem::take(&mut word));
            }
        }
    }

if !word.is_empty() {
        out.push(word);
    }
    out
}

#[pyfunction]
fnbatch_process(texts: Vec<String>) -> PyResult<Vec<Vec<String>>> {
Ok(texts.iter().map(|t| process_one(t)).collect())
}

// 变更 2:添加并行版本函数
#[pyfunction]
fnbatch_process_parallel(texts: Vec<String>) -> PyResult<Vec<Vec<String>>> {
Ok(texts.par_iter().map(|t| process_one(t)).collect())
}

#[pymodule]
fnrust_text(_py: Python<'_>, m: &Bound<PyModule>) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(batch_process, m)?)?;
// 变更 3:注册并行函数
    m.add_function(wrap_pyfunction!(batch_process_parallel, m)?)?;
Ok(())
}

性能对比结果

--- Benchmark ---
Python      median: 5.171 s | throughput:  96,694 texts/s
Rust 1-thread median: 3.091 s | throughput: 161,755 texts/s
Rust Rayon  median: 2.223 s | throughput: 224,914 texts/s
实现方式
处理时间
吞吐量
相比 Python 提升
纯 Python
5.171 s
96,694 texts/s
基准
Rust 单线程
3.091 s
161,755 texts/s
+67%
Rust + Rayon 并行
2.223 s
224,914 texts/s
+133%

并行化的 Rust 代码比非并行化的 Rust 时间缩短了约 27%,比纯 Python 代码快两倍以上


总结

Python 对于大多数任务来说通常足够快。但如果性能分析显示有一个无法向量化的慢点,你不必放弃 Python 或重写整个项目。相反,只需将性能关键部分移到 Rust,其余代码保持不变

使用 PyO3 和 maturin,你可以将 Rust 代码编译成与现有库无缝协作的 Python 模块,同时保留大部分 Python 代码、测试、打包和工作流,在最需要的地方获得 Rust 的速度、内存安全和并发优势。

这里简单的示例和基准测试表明,只需将代码的一小部分用 Rust 重写,就能使 Python 快得多。添加 Rayon 进行并行化可以进一步提升性能,而代码变化极少,也不需要复杂的工具。这是一种在不将整个项目切换到 Rust 的情况下加速 Python 工作负载的实用且简单的方法。

往期推荐

高效长上下文 RAG 的 5 种技术

如何使用 Gemma 4 和 Python 实现工具调用

从4周到45分钟:为4700多份PDF设计文档提取系统

掌握智能体 AI 系统中记忆的 7 个步骤


原文标题:How to Call Rust from Python
作者:Thomas Reid
发布时间:2026年4月21日
来源Towards Data Science


最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 08:24:22 HTTP/2.0 GET : https://f.mffb.com.cn/a/491111.html
  2. 运行时间 : 0.127970s [ 吞吐率:7.81req/s ] 内存消耗:4,744.22kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=b4d8718a4bb5f89f4ac7f74ceac98dac
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000621s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000932s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000371s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000310s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000478s ]
  6. SELECT * FROM `set` [ RunTime:0.000202s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000693s ]
  8. SELECT * FROM `article` WHERE `id` = 491111 LIMIT 1 [ RunTime:0.001304s ]
  9. UPDATE `article` SET `lasttime` = 1783124662 WHERE `id` = 491111 [ RunTime:0.012561s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000309s ]
  11. SELECT * FROM `article` WHERE `id` < 491111 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000499s ]
  12. SELECT * FROM `article` WHERE `id` > 491111 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000387s ]
  13. SELECT * FROM `article` WHERE `id` < 491111 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001070s ]
  14. SELECT * FROM `article` WHERE `id` < 491111 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.017114s ]
  15. SELECT * FROM `article` WHERE `id` < 491111 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.019069s ]
0.130614s