Skip to content

Commit 69be700

Browse files
committed
Enabling compression for arrow data in visualizations
1 parent 4d1fb20 commit 69be700

File tree

6 files changed

+2995
-11849
lines changed

6 files changed

+2995
-11849
lines changed

pkg/query/flamegraph_arrow.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func GenerateFlamegraphArrow(
8989
w := ipc.NewWriter(&buf,
9090
ipc.WithSchema(record.Schema()),
9191
ipc.WithAllocator(mem),
92+
ipc.WithLZ4(),
9293
)
9394
defer w.Close()
9495

pkg/query/sources.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func GenerateSourceReport(
5656
w := ipc.NewWriter(&buf,
5757
ipc.WithSchema(record.Schema()),
5858
ipc.WithAllocator(pool),
59+
ipc.WithLZ4(),
5960
)
6061
defer w.Close()
6162

pkg/query/table.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func GenerateTable(
7373
w := ipc.NewWriter(&buf,
7474
ipc.WithSchema(record.Schema()),
7575
ipc.WithAllocator(mem),
76+
ipc.WithLZ4(),
7677
)
7778
defer w.Close()
7879

ui/packages/shared/profile/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/fast-levenshtein": "^0.0.4",
2828
"@types/react-beautiful-dnd": "^13.1.8",
2929
"@uwdata/flechette": "^2.3.0",
30+
"lz4js": "^0.2.0",
3031
"classnames": "^2.3.1",
3132
"d3": "7.9.0",
3233
"d3-array": "^3.2.4",
@@ -62,6 +63,7 @@
6263
},
6364
"devDependencies": {
6465
"@types/lodash.throttle": "4.1.9",
66+
"@types/lz4js": "^0.2.1",
6567
"@types/react-syntax-highlighter": "15.5.13"
6668
},
6769
"main": "dist/index.js",

ui/packages/shared/profile/src/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
import {CompressionType, setCompressionCodec} from '@uwdata/flechette';
15+
import * as lz4 from 'lz4js';
16+
1417
import type {ParamPreferences} from '@parca/components';
1518

1619
import MetricsGraph, {type ContextMenuItemOrSubmenu, type Series} from './MetricsGraph';
@@ -27,6 +30,11 @@ import {UnifiedLabelsProvider, useUnifiedLabels} from './contexts/UnifiedLabelsC
2730
import {useLabelNames} from './hooks/useLabels';
2831
import {useQueryState} from './hooks/useQueryState';
2932

33+
setCompressionCodec(CompressionType.LZ4_FRAME, {
34+
encode: (data: Uint8Array) => lz4.compress(data),
35+
decode: (data: Uint8Array) => lz4.decompress(data),
36+
});
37+
3038
export {useMetricsGraphDimensions} from './MetricsGraph/useMetricsGraphDimensions';
3139

3240
export * from './ProfileFlameChart';

0 commit comments

Comments
 (0)