Skip to content

Commit cbb4b1e

Browse files
committed
benchmark is showing slow things happening with cgo
1 parent 2307b41 commit cbb4b1e

File tree

7 files changed

+3020
-14
lines changed

7 files changed

+3020
-14
lines changed

buffer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ func PyBuffersToBuffers(pyBuffers *python3.PyObject) ([]*memory.Buffer, error) {
1515
}
1616

1717
length := python3.PyList_Size(pyBuffers)
18-
buffers := make([]*memory.Buffer, length)
18+
buffers := make([]*memory.Buffer, 0, length)
1919
for i := 0; i < length; i++ {
2020
buffer, err := PyBuffersGetBuffer(pyBuffers, i)
2121
if err != nil {
2222
return nil, err
2323
}
24-
buffers[i] = buffer
24+
// buffers[i] = buffer
25+
buffers = append(buffers, buffer)
2526
}
2627

2728
return buffers, nil

chunked.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ func PyChunkedToChunks(pyChunked *python3.PyObject, dtype arrow.DataType) ([]arr
3232
}
3333

3434
length := python3.PyList_Size(pyChunks)
35-
chunks := make([]array.Interface, length)
35+
chunks := make([]array.Interface, 0, length)
3636
for i := 0; i < length; i++ {
3737
chunk, err := PyChunksGetChunk(pyChunks, i, dtype)
3838
if err != nil {
3939
return nil, err
4040
}
41-
chunks[i] = chunk
41+
// chunks[i] = chunk
42+
chunks = append(chunks, chunk)
4243
}
4344

4445
return chunks, nil

cpu.prof

38 KB
Binary file not shown.

0 commit comments

Comments
 (0)