-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d3ae5f
commit f3a92e4
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
uid: 20250227091812 | ||
title: 用二分查找算法排查问题插件 | ||
tags: [] | ||
description: 用二分查找算法排查问题插件 | ||
author: Obsidianer | ||
type: other | ||
draft: false | ||
editable: false | ||
modified: 20250227092051 | ||
--- | ||
|
||
# 用二分查找算法排查问题插件 | ||
|
||
- 为了快速定位出问题的 Obsidian 插件,可以采用二分查找算法 (Binary Search)。这是一种时间复杂度为 O(log n) 的高效方法,能将测试次数从线性 (逐个尝试) 降低到对数级别。 | ||
|
||
## 算法原理 | ||
|
||
- 把插件分成两组,禁其中一组,看看问题是否解决。如果解决了,说明问题插件在被禁用的一组里; 如果没解决,就在另一组。然后重复这个过程,每次将可能的范围缩小一这样对于 100 多个插件来说,大概需要 log2(100)~7 次测试就能找到,比逐个检查快很多,时间复杂度为 O(logn) | ||
|
||
## 具体操作步骤 | ||
|
||
1. **初始分组** | ||
将所有插件分为两组(A 组和 B 组),每组约 50 个插件。 | ||
2. **第一次测试** | ||
- **禁用 B 组所有插件**,保留 A 组启用。 | ||
- 观察问题是否复现: | ||
- **问题消失** → 问题插件在 B 组。 | ||
- **问题仍在** → 问题插件在 A 组。 | ||
|
||
3. **迭代缩小范围** | ||
对包含问题插件的组重复上述步骤: | ||
- 将该组再分为两半,禁用其中一半。 | ||
- 根据测试结果继续缩小范围。 | ||
4. **最终定位** | ||
重复至只剩 1 个插件时,通过单独启用/禁用它确认是否为问题插件。 | ||
|
||
## 实际操作 (以 100 个插件最坏结果为例) | ||
|
||
- 第 1 轮: 禁用 50 个插件 -->剩余 50 个待排查 | ||
- 第 2 轮: 禁用 25 个插件 -->剩余 25 个待排查 | ||
- 第 3 轮: 禁用 12 个插件 -->剩余 13 个待排查 | ||
- 第 4 轮: 禁用 6 个插件 -->剩余 7 个待排查 | ||
- 第 5 轮: 禁用 3 个插件 -->剩余 4 个待排查 | ||
- 第 6 轮: 禁用 2 个插件 -->剩余 2 个待排查 | ||
- 第 7 轮: 禁用 1 个插件 -->定位到问题插件 | ||
|
||
## 其他 | ||
|
||
Obsidian 常见问题可以常看 [[Obsidian常见问题汇总]],这里面汇总了主题类,插件类各种问题 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters