cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

profiler use string_view as argument

Open PatriceJiang opened this issue 1 year ago • 1 comments

Re: #

Changelog


Continuous Integration

This pull request:

  • [ ] needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • [ ] does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • [ ] changes public API, and have ensured backward compatibility with deprecated features.
  • [ ] affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • [ ] affects file structure of the build package or build configuration which requires user project upgrade.
  • [ ] introduces breaking changes, please list all changes, affected features and the scope of violation.

PatriceJiang avatar Aug 12 '22 03:08 PatriceJiang

Interface Check Report

This pull request does not change any public interfaces !

github-actions[bot] avatar Aug 12 '22 03:08 github-actions[bot]

Why change to use string_view?

minggo avatar Aug 15 '22 01:08 minggo

Why change to use string_view?

Reduce the temporarily allocated string objects and improve the performance of profiler.

PatriceJiang avatar Aug 15 '22 01:08 PatriceJiang

Do you have any performance test data?

minggo avatar Aug 15 '22 09:08 minggo

I ran bunny test with 50K nodes on PC, the FPS changed from 20 to 24 after applying string_view.

I profiled 2 function that created 100K temporary string objects per-frame.

PatriceJiang avatar Aug 16 '22 01:08 PatriceJiang

It seems valuable. Please make sure if ccstd::pmr::string can work with std::string_view.

minggo avatar Aug 16 '22 02:08 minggo

It seems valuable. Please make sure if ccstd::pmr::string can work with std::string_view.

Yes. string_view works fine with pmr::string

PatriceJiang avatar Aug 30 '22 03:08 PatriceJiang