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

Optimize G_FpsMonitor sorting #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Rapilias
Copy link

@Rapilias Rapilias commented Dec 25, 2023

Introduction

Thank you for developing such a convenient library. I've been using it very comfortably.

Summary

This PR is a bug fixed version of #114
The part of G_FpsMonitor.cs that had been a TODO was addressed.
This can reduce the load generated by FpsMonitor. In particular, we have seen significant improvements in Windows build artifacts.

Checked

            // After `m_fpsSamplesSorted[ sortedInsertIndex ] = CurrentFPS;` Line.
            var testSoreted = m_fpsSamples.ToArray();
            Array.Sort(testSoreted);
            var isSame = testSoreted.SequenceEqual(m_fpsSamplesSorted);
            if(isSame == false)
                Debug.LogError("isSame == false");
  • I changed the max FPS several times, ran it for about 10 minutes and no error is shown.

before WinBuild IL2CPP(Development)

スクリーンショット 2023-12-25 000412
Sometime spikes, as follows
スクリーンショット 2023-12-25 005157

after WinBuild IL2CPP(Development)

スクリーンショット 2023-12-25 000911

before WinEditor

スクリーンショット 2023-12-25 001118

after WinEditor

スクリーンショット 2023-12-25 000947

  • Faster than graphy/master impl
  • Zero allocate
Original(Japanese)

概要

G_FpsMonitor.cs のTODOになっていた箇所の対応を行いました。
これにより、FpsMonitorで発生する負荷を軽減する事が可能です。特に、Windowsのビルド成果物で大きな改善が見られます。

確認

            // After `m_fpsSamplesSorted[ sortedInsertIndex ] = CurrentFPS;` Line.
            var testSoreted = m_fpsSamples.ToArray();
            Array.Sort(testSoreted);
            var isSame = testSoreted.SequenceEqual(m_fpsSamplesSorted);
            if(isSame == false)
                Debug.LogError("isSame == false");
  • 何度か最大FPSを変更して10分程動かしてエラーが表示されない

before(not DeepProfiler) WinBuild IL2CPP(Development)

スクリーンショット 2023-12-25 000412
時折スパイクし、以下のようになる
スクリーンショット 2023-12-25 005157

after(not DeepProfiler) WinBuild IL2CPP(Development)

スクリーンショット 2023-12-25 000911

before(not DeepProfiler) WinEditor

スクリーンショット 2023-12-25 001118

after(not DeepProfiler) WinEditor

スクリーンショット 2023-12-25 000947

  • graphy/masterより高速化されている
  • メモリ割り当て無し

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant