GH-44491: [C++] Static Status draft
Rationale for this change
It'd be convenient to construct placeholder error Status cheaply.
What changes are included in this PR?
Added bool Status::State::is_static which causes copies to be shallow and skips destruction.
Are these changes tested?
Not yet. Also, the main consideration is probably benchmarks to make sure hot paths don't get much slower.
Are there any user-facing changes?
I don't think we want this API to be public
- GitHub Issue: #44491
:warning: GitHub issue #44491 has been automatically assigned in GitHub to PR creator.
@pitrou @felipecrv which benchmark would be convincing as a demonstration this doesn't slow us down? I don't think we have an explicit status or result benchmark
For now (since it seems to me to have the deepest Status bubbling stack),
@ursabot please benchmark command=cpp-micro --suite-filter=grouper
I don't think we have an explicit status or result benchmark
We do, but for some reason I had stuffed it in type_benchmark.cc
https://github.com/apache/arrow/blob/1b4080032a86cacd9b21988514438ac3d5696d81/cpp/src/arrow/type_benchmark.cc#L545-L555
@ursabot please benchmark command=cpp-micro --suite-filter=type
Benchmark runs are scheduled for commit f7d3fffa53a07548fa42fc15d48a001bf141b5b6. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete.
Thanks for your patience. Conbench analyzed the 3 benchmarking runs that have been run so far on PR commit f7d3fffa53a07548fa42fc15d48a001bf141b5b6.
There were 4 benchmark results indicating a performance regression:
-
Pull Request Run on
amd64-m5-4xlarge-linuxat 2024-10-25 16:10:52Z -
Pull Request Run on
amd64-c6a-4xlarge-linuxat 2024-10-25 16:06:02Z -
and 2 more (see the report linked below)
The full Conbench report has more details.
@pitrou @felipecrv which benchmark would be convincing as a demonstration this doesn't slow us down? I don't think we have an explicit status or result benchmark
Can you check the binary size impact with bloaty?
The performance impact is very tiny but everywhere a Status gets destroyed (all over the place). I think checking binary size is a good proxy to keeping the shape of the code the same.
Can you check the binary size impact with
bloaty?
$ $ bloaty build/relwithdebinfo/libarrow.so -- main-build/relwithdebinfo/libarrow.so
FILE SIZE VM SIZE
-------------- --------------
+0.1% +14.2Ki [ = ] 0 .debug_str
+14% +1.17Ki [ = ] 0 [Unmapped]
+0.0% +1.14Ki [ = ] 0 .strtab
+0.0% +250 +0.0% +250 .dynstr
[ = ] 0 +0.0% +64 .bss
-100.0% +50 -100.0% +30 [7 Others]
-0.1% -40 -0.1% -40 .got.plt
-0.0% -72 -0.0% -72 .dynsym
-0.1% -80 -0.1% -80 .plt
-0.1% -120 -0.1% -120 .rela.plt
-0.0% -288 [ = ] 0 .symtab
-0.1% -533 [ = ] 0 .debug_abbrev
-1.2% -3.74Ki -1.2% -3.74Ki .gcc_except_table
-0.4% -10.00Ki [ = ] 0 .debug_str_offsets
-1.3% -13.4Ki -1.3% -13.4Ki .eh_frame
# This seems the most relevant data point; no significant change
-0.6% -48.0Ki -0.6% -48.0Ki .text
-2.2% -86.1Ki [ = ] 0 .debug_addr
-1.7% -146Ki [ = ] 0 .debug_line
-3.4% -164Ki [ = ] 0 .debug_rnglists
-2.1% -347Ki [ = ] 0 .debug_loclists
-1.3% -539Ki [ = ] 0 .debug_info
-1.2% -1.31Mi -0.4% -65.1Ki TOTAL```
@ursabot please benchmark command=cpp-micro --suite-filter=type --benchmark-filter=Error
Benchmark runs are scheduled for commit 86741d645da005b2ed17e30aebdef7b6e02633de. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete.
Thanks for your patience. Conbench analyzed the 3 benchmarking runs that have been run so far on PR commit 86741d645da005b2ed17e30aebdef7b6e02633de.
There were 2 benchmark results indicating a performance regression:
-
Pull Request Run on
amd64-c6a-4xlarge-linuxat 2024-11-04 18:08:18Z -
Pull Request Run on
amd64-m5-4xlarge-linuxat 2024-11-04 18:12:34Z
The full Conbench report has more details.
Those regressions have got to be flukes; they don't even touch Status
Yes, the code changes probably trigger random variation in code placement in these benchmarks, that could explain the false regressions.
@github-actions crossbow submit -g cpp
Revision: be910af7efb3ea2a898b1bed1113a77e2cf7754e
Submitted crossbow builds: ursacomputing/crossbow @ actions-daf4798abf
CI failures are unrelated, I'll merge.
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 29e8ea011045ba4318a552567a26b2bb0a7d3f05.
There were no benchmark performance regressions. 🎉
The full Conbench report has more details. It also includes information about 114 possible false positives for unstable benchmarks that are known to sometimes produce them.