You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Antoine Pitrou (JIRA)" <ji...@apache.org> on 2018/04/05 10:58:00 UTC

[jira] [Comment Edited] (ARROW-2400) [C++] Status destructor is expensive

    [ https://issues.apache.org/jira/browse/ARROW-2400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16426749#comment-16426749 ] 

Antoine Pitrou edited comment on ARROW-2400 at 4/5/18 10:57 AM:
----------------------------------------------------------------

The figures above were with gcc 4.9. If I switch to clang 5.0 the slowdown is much smaller, but still exists:

* with the normal destructor:
{code:bash}
$ python -m timeit -s "import pyarrow as pa; data = [b'xx' for i in range(10000)]" "pa.array(data, type=pa.binary())"
1000 loops, best of 3: 546 usec per loop
{code}

* with an empty destructor:
{code:bash}
$ python -m timeit -s "import pyarrow as pa; data = [b'xx' for i in range(10000)]" "pa.array(data, type=pa.binary())"
1000 loops, best of 3: 520 usec per loop
{code}



was (Author: pitrou):
The figures above were with gcc 4.9. If I switch to clang 5.0 the slowdown is much smaller, but still exists:

* with the normal destructor:
{code:shell}
$ python -m timeit -s "import pyarrow as pa; data = [b'xx' for i in range(10000)]" "pa.array(data, type=pa.binary())"
1000 loops, best of 3: 546 usec per loop
{code}

* with an empty destructor:
{code:shell}
$ python -m timeit -s "import pyarrow as pa; data = [b'xx' for i in range(10000)]" "pa.array(data, type=pa.binary())"
1000 loops, best of 3: 520 usec per loop
{code}


> [C++] Status destructor is expensive
> ------------------------------------
>
>                 Key: ARROW-2400
>                 URL: https://issues.apache.org/jira/browse/ARROW-2400
>             Project: Apache Arrow
>          Issue Type: Improvement
>    Affects Versions: 0.9.0
>            Reporter: Antoine Pitrou
>            Priority: Major
>
> Let's take the following micro-benchmark (in Python):
> {code:bash}
> $ python -m timeit -s "import pyarrow as pa; data = [b'xx' for i in range(10000)]" "pa.array(data, type=pa.binary())"
> 1000 loops, best of 3: 784 usec per loop
> {code}
> If I replace the Status destructor with a no-op:
> {code:c++}
>   ~Status() { }
> {code}
> then the benchmark result becomes:
> {code:bash}
> $ python -m timeit -s "import pyarrow as pa; data = [b'xx' for i in range(10000)]" "pa.array(data, type=pa.binary())"
> 1000 loops, best of 3: 561 usec per loop
> {code}
> This is almost a 30% win. I get similar results on the conversion benchmarks in the benchmark suite.
> I'm unsure about the explanation. In the common case, {{delete _state}} should be extremely fast, since the state is NULL. Yet, it seems it adds significant overhead. Perhaps because of exception handling?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)