arrow icon indicating copy to clipboard operation
arrow copied to clipboard

GH-44491: [C++] Static Status draft

Open bkietz opened this issue 1 year ago • 1 comments

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

bkietz avatar Oct 21 '24 20:10 bkietz

:warning: GitHub issue #44491 has been automatically assigned in GitHub to PR creator.

github-actions[bot] avatar Oct 21 '24 20:10 github-actions[bot]

@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

bkietz avatar Oct 25 '24 15:10 bkietz

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

pitrou avatar Oct 25 '24 15:10 pitrou

@ursabot please benchmark command=cpp-micro --suite-filter=type

bkietz avatar Oct 25 '24 15:10 bkietz

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.

ursabot avatar Oct 25 '24 15:10 ursabot

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:

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.

felipecrv avatar Oct 30 '24 22:10 felipecrv

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```

bkietz avatar Nov 04 '24 17:11 bkietz

@ursabot please benchmark command=cpp-micro --suite-filter=type --benchmark-filter=Error

bkietz avatar Nov 04 '24 17:11 bkietz

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.

ursabot avatar Nov 04 '24 17:11 ursabot

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:

The full Conbench report has more details.

Those regressions have got to be flukes; they don't even touch Status

bkietz avatar Nov 04 '24 19:11 bkietz

Yes, the code changes probably trigger random variation in code placement in these benchmarks, that could explain the false regressions.

pitrou avatar Nov 04 '24 19:11 pitrou

@github-actions crossbow submit -g cpp

pitrou avatar Nov 14 '24 15:11 pitrou

Revision: be910af7efb3ea2a898b1bed1113a77e2cf7754e

Submitted crossbow builds: ursacomputing/crossbow @ actions-daf4798abf

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-cuda-cpp-ubuntu-20.04-cuda-11.2.2 GitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1 GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-ubuntu-20.04-cpp GitHub Actions
test-ubuntu-20.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

github-actions[bot] avatar Nov 14 '24 15:11 github-actions[bot]

CI failures are unrelated, I'll merge.

pitrou avatar Nov 14 '24 16:11 pitrou

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.