HelloZeroNet / HelloZeroNet/ZeroNet

Slow start due to quadratic time algorithms

オープン
#2,770 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
18.8k
フォーク
2.3k
PR マージ指標
30日以内にマージされた PR はありません

説明

### Step 1: Please describe your environment

* ZeroNet version: v0.7.2 (rev4555)
* Operating system: N/A
* Web browser: N/A
* Tor status: N/A
* Opened port: N/A
* Special configuration: N/A

### Step 2: Describe the problem:

ZeroNet takes about an hour to start with a few thousand sites downloaded.

The logs say:

```
[13:03:17] SiteManager Added new site: [address]
[13:03:17] Site:1A28C5..E1dw ContentDb init: 0.000s, found files: 0, sites: 8963
[13:03:17] Site:1A28C5..E1dw ContentDb not initialized, load files from filesystem...
[13:03:17] Site:1A28C5..E1dw Content.json not exist: ./data/[address]/content.json
[13:03:17] RateLimit Added to queue (2.75s left): Save sites.json
[13:03:17] SiteManager Updated merger sites in 0.601s
```
(repeat a few thousand times)

The 'Updated merger sites' seems to be the culprit. It's from `SiteManagerPlugin.updateMergerSites`, which scans all the downloaded sites, and is invoked every time a site is initialized. That takes quadratic time.

#### Steps to reproduce:

1. Create/download lots of sites
2. ???
3. PROFIT

#### Observed Results:

Quadratic time intiailization.

#### Expected Results:

Linear (ideally) time initialization.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start at SiteManagerPlugin.updateMergerSites and trace where it is invoked during site initialization. Reproduce startup with a large collection of downloaded sites while reviewing the repeated “Updated merger sites” timings. Done means initialization no longer rescans all sites quadratically and startup time scales linearly or substantially better.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
backend, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。