Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

レイアウト処理の負荷を下げる為、コメントが色分け表示対象外になる機会を増やす #1052

Merged
merged 2 commits into from Sep 22, 2019

Conversation

beru
Copy link
Contributor

@beru beru commented Sep 22, 2019

PR の目的

コメントが色分け表示対象外になる機会を増やす事でレイアウト処理の負荷を減らすのが目的です。

カテゴリ

  • 速度向上

PR の背景

CColor_LineComment::DispCColor_BlockComment::Disp メソッドの実装を更新して、タイプ別設定 『カラー』プロパティのコメントのリストアイテムのチェックが付いていても始点・終端記号が入力されていない場合は false を返すようにしました。

リストアイテムのチェックはデフォルト設定では付いているので、従来はコメントの始点・終端記号が空の場合でも true が返されていました。

CColorStrategyPool::OnChangeSettingDisp メソッドが false を返すと 色分け表示対象外になり
CColorStrategyPool::CheckColorMODE において色開始処理が呼ばれない為にレイアウト処理の負荷が軽くなります。

PR のメリット

従来に比べてレイアウト処理の負荷が下がる機会が増えます。

PR のデメリット (トレードオフとかあれば)

Disp メソッドの実装がやや複雑になります。コメントを書く事で対策しました。

タイプ別設定 『カラー』プロパティのコメントのリストアイテムのチェックを既に外している場合はそれから比べて処理負荷の低減がされません。またタイプ別設定によってはコメントを有効にして使うと思うのでその場合も処理負荷の低減がされません。

かなり大きい文書を扱っている時でないとレイアウト処理から呼び出される CColorStrategyPool::CheckColorMODE の処理時間が体感出来るほどに膨らむことは無いかもしれません。

PR の影響範囲

CColorStrategyPool クラス

CColor_LineComment::Disp と CColor_BlockComment::Disp メソッドの実装を更新

タイプ別設定 『カラー』プロパティのコメントのリストアイテムのチェックが付いていても始点・終端記号が入力されていない場合は false を返すようにした。
リストアイテムのチェックはデフォルト設定では付いているので、従来はコメントの始点・終端記号が空の場合でも true を返していた。

CColorStrategyPool::OnChangeSetting で Disp メソッドが false を返すと 色分け表示対象外になり
CColorStrategyPool::CheckColorMODE において色開始処理が呼ばれない為にレイアウト処理の負荷が軽くなる。
@beru beru added the 🚅 speed up 🚀 高速化 label Sep 22, 2019
@beru beru changed the title レイアウト処理の負荷を下げる為、コメントが色分け表示対象外になる機会を増やす変更 レイアウト処理の負荷を下げる為、コメントが色分け表示対象外になる機会を増やす Sep 22, 2019
@AppVeyorBot
Copy link

Build sakura 1.0.2262 completed (commit 43484fc7be by @beru)

@@ -38,7 +38,7 @@ class CLineComment
void CopyTo( const int n, const wchar_t* buffer, int nCommentPos ); // 行コメントデリミタをコピーする
bool Match( int nPos, const CStringRef& cStr ) const; // 行コメントに値するか確認する

const wchar_t* getLineComment( const int n ){
const wchar_t* getLineComment( const int n ) const{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変更の趣旨と関係ないように思うんですが、変更には賛成です。

constなデータを参照するのに非constメソッドとしていることに違和感を感じました。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disp は const メソッドなのでそこから呼び出すには const る必要があるはずです。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すんません。

無関係に思う ⇒ 関係大アリです。

了解っす 😢

sakura_core/view/colors/CColor_Comment.h Outdated Show resolved Hide resolved
sakura_core/view/colors/CColor_Comment.h Show resolved Hide resolved
sakura_core/view/colors/CColor_Comment.h Outdated Show resolved Hide resolved
@AppVeyorBot
Copy link

Build sakura 1.0.2264 completed (commit bdc6cec81a by @)

Copy link
Contributor

@berryzplus berryzplus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

特に問題ないと思います。

@beru
Copy link
Contributor Author

beru commented Sep 22, 2019

レビューありがとうございました。Mergeします。
もし問題が見つかったら別PRで対処します。

@beru beru merged commit b66e259 into sakura-editor:master Sep 22, 2019
@beru beru deleted the CheckColorMODE branch September 22, 2019 11:17
@m-tmatma m-tmatma added this to the v2.4.0 milestone Dec 29, 2019
HoppingTappy pushed a commit to HoppingTappy/sakura that referenced this pull request Jun 16, 2020
レイアウト処理の負荷を下げる為、コメントが色分け表示対象外になる機会を増やす
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants