apache / apache/pinot

Benchmark data table serialization logic and pre-allocate byte[] array if need be

Open
#6,714 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
189

Description

As @siddharthteotia pointed out in https://github.com/apache/incubator-pinot/pull/6710#discussion_r599240463_

> serialization functions first writes to a temporary output stream and then converts to byte array which is returned to the caller and written to the main stream. I think the reason for doing that is upfront we don't know the length of byte[] array to allocate.

> However, we can probably do different and it might be faster
>* Write a loop to go over each entry and keep a running sum of size
>* At the end of loop, allocate byte array of that size
>* Start another loop and go over each entry again and fill out the pre-allocated byte array.
>* Return the filled byte array

We need to benchmark this two serialization approach. If the proposed approach is better, will send a PR to address it.

Contributor guide

Open the contributing guide

Research direction

Start by locating the serialization functions discussed in pull request #6710. Benchmark the existing temporary-output-stream approach against the proposed size-calculation and pre-allocation approach; done means the results clearly show whether the proposed approach is faster and whether a follow-up change is justified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.