Calling custom inlined function was significantly faster than using base::EraseIf |
||
Issue descriptionI was investigating a perf regression with the passthrough command buffer. I ended up coding a solution implemented in http://crrev.com/c/1247941 . During implementation of my solution I found: a) calling base::EraseIf was slower than calling std::erase/std::remove_if. b) forcing ALWAYS_INLINE on base::EraseIf seemed to improve things. c) writing a custom iterating deleter over a std::vector was faster than inlined base::EraseIf or the inlined std::erase/std::remove_if. (~5% improved score) It does seem like Clang can be reluctant to inline functions at times. Using ALWAYS_INLINE does always work. Otherwise it may decide not to inline functions even if marked inline. Also there could be potentially some slowness in the STL functions for iterate-based erase. dcheng assigning to you for triage. I can provide more info on my experiments if needed. Not sure what components to use for this issue.
,
Oct 1
Which platform did you measure this on?
,
Oct 1
Windows / x64 / official build.
,
Oct 1
Windows generally builds with "optimize for size" than "optimize for speed", except for some high-impact targets that opt for larger code size in return for higher speed (https://cs.chromium.org/search/?q=optimize_max+file:%5C.gn&sq=package:chromium&type=cs). So maybe this is all working as intended?
,
Oct 12
OK, let's leave things as-is. In general, optimizing for size is probably the right thing to do, and if certain places really need the speed, they can always manually inline. |
||
►
Sign in to add a comment |
||
Comment 1 by piman@chromium.org
, Oct 1