You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "wkalt (via GitHub)" <gi...@apache.org> on 2024/06/24 00:58:57 UTC
[PR] GH-43015: [Go] Reuse column compressors in IPC module [arrow]
wkalt opened a new pull request, #43016:
URL: https://github.com/apache/arrow/pull/43016
This changes the IPC writer to reuse lz4 or zstd compressors instead of instantiating new ones on each call to Write. Prior to this commit we would instantiate as many encoders per Write call as the configured number of concurrent compression workers, even though the compressors are reusable across calls.
### Are these changes tested?
I have added no tests and have not yet closely verified the patch. There's no functional change to test and I want to get agreement on the approach before solidifying it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43015: [Go] Reuse column compressors in IPC module [arrow]
Posted by "wkalt (via GitHub)" <gi...@apache.org>.
wkalt commented on PR #43016:
URL: https://github.com/apache/arrow/pull/43016#issuecomment-2185417859
@zeroshade I have a ROS to Arrow transcoder I am trying to speed up and stumbled on this. I think we don't actually need the sync pool here - an alternative would be to assign each worker their own compressor and that would reduce synchronization a bit. I wrote it this way mostly to keep the change simple and isolated.
The data file I am working with contains 126238 messages that look like this:
```
{"topic":"/fix","sequence":1193398,"log_time":1479513060.001367422,"publish_time":1479513060.001367422,"data":{"header":{"seq":115877,"stamp":1479513060.000963926,"frame_id":"/imu"},"status":{"status":0,"service":0},"latitude":37.39954376220703,"longitude":-122.10643005371094,"altitude":-8.820882797241211,"position_covariance":[0,0,0,0,0,0,0,0,0],"position_covariance_type":0}}
```
My benchmark converts this file from MCAP to Arrow format. Baseline looks like this:
```
[~/projects/dp3/util/schema] (task/expression-evaluation) $ go test -benchmem -run=^$ -count 5 -bench ^Bench -cpuprofile cpu.prof -memprofile mem.prof
goos: linux
goarch: amd64
pkg: github.com/wkalt/dp3/util/schema
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
BenchmarkArrowConversion-8 2 623131080 ns/op 2300084172 B/op 615378 allocs/op
BenchmarkArrowConversion-8 2 639044632 ns/op 2300142164 B/op 615470 allocs/op
BenchmarkArrowConversion-8 2 684075134 ns/op 2300133412 B/op 615438 allocs/op
BenchmarkArrowConversion-8 2 625924289 ns/op 2300128356 B/op 615453 allocs/op
BenchmarkArrowConversion-8 2 612030702 ns/op 2300119648 B/op 615439 allocs/op
```
With this patch, like this:
```
(pprof) [~/projects/dp3/util/schema] (task/expression-evaluation) $ go test -benchmem -run=^$ -count 5 -bench ^Bench -cpuprofile cpu.prof -memprofile mem.prof
goos: linux
goarch: amd64
pkg: github.com/wkalt/dp3/util/schema
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
BenchmarkArrowConversion-8 3 390956287 ns/op 523875962 B/op 589463 allocs/op
BenchmarkArrowConversion-8 3 396933067 ns/op 586279402 B/op 590974 allocs/op
BenchmarkArrowConversion-8 3 409683638 ns/op 549911458 B/op 590131 allocs/op
BenchmarkArrowConversion-8 3 381790188 ns/op 508226698 B/op 589033 allocs/op
BenchmarkArrowConversion-8 3 389944825 ns/op 575889501 B/op 590775 allocs/op
PASS
ok github.com/wkalt/dp3/util/schema 12.067s
```
so, roughly 30-35% reduction in time/op, and ~75% reduction in bytes allocated. I am using a batch size of 1K records into my record batches. I can't split my benchmark out of my project very easily but would expect this effect to be pretty easy to reproduce. Let me know what you think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43015: [Go] Reuse column compressors in IPC module [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #43016:
URL: https://github.com/apache/arrow/pull/43016#issuecomment-2185401820
:warning: GitHub issue #43015 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org