You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/04/15 15:24:00 UTC

[jira] [Resolved] (ARROW-11568) [C++][Compute] Mode kernel performance is bad in some conditions

     [ https://issues.apache.org/jira/browse/ARROW-11568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Pitrou resolved ARROW-11568.
------------------------------------
    Fix Version/s: 4.0.0
       Resolution: Fixed

Issue resolved by pull request 10009
[https://github.com/apache/arrow/pull/10009]

> [C++][Compute] Mode kernel performance is bad in some conditions
> ----------------------------------------------------------------
>
>                 Key: ARROW-11568
>                 URL: https://issues.apache.org/jira/browse/ARROW-11568
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Yibo Cai
>            Assignee: Yibo Cai
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> Comparing with scipy.stats.mode, arrow mode kernel is much slower in some conditions. See below example.
> {noformat}
> In [1]: import numpy as np
> In [2]: import scipy.stats
> In [3]: import pyarrow.compute as pc
> In [4]: f = np.random.rand(12345678)
> In [5]: time scipy.stats.mode(f)
> CPU times: user 1.14 s, sys: 111 ms, total: 1.25 s
> Wall time: 1.25 s
> Out[5]: ModeResult(mode=array([2.25710692e-08]), count=array([1]))
> In [6]: time pc.mode(f)[0]
> CPU times: user 8.44 s, sys: 338 ms, total: 8.77 s
> Wall time: 8.77 s
> Out[6]: <pyarrow.StructScalar: {'mode': 2.2571069235866048e-08, 'count': 1}>
> In [7]: i = np.random.randint(0, 1234567, 12345678)
> In [8]: time scipy.stats.mode(i)
> CPU times: user 1.03 s, sys: 3.11 ms, total: 1.03 s
> Wall time: 1.03 s
> Out[8]: ModeResult(mode=array([607002]), count=array([28]))
> In [9]: time pc.mode(i)[0]
> CPU times: user 1.57 s, sys: 0 ns, total: 1.57 s
> Wall time: 1.57 s
> Out[9]: <pyarrow.StructScalar: {'mode': 607002, 'count': 28}>
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)