Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BENCH: Add peakmem benchmarks for rolling #28255

Merged
merged 1 commit into from
Sep 3, 2019

Conversation

mroeschke
Copy link
Member

$ asv dev -b rolling

[ 20.00%] ··· rolling.Methods.peakmem_rolling                                                                                                                                                             ok
[ 20.00%] ··· ============ ======== ======= ======== ======= ======= ======= ======= ======= ======= ======= =======
              --                                                             method
              ----------------------------- ------------------------------------------------------------------------
               contructor   window   dtype   median    mean    max     min     std    count    skew    kurt    sum
              ============ ======== ======= ======== ======= ======= ======= ======= ======= ======= ======= =======
               DataFrame      10      int    69.4M    67.7M   67.8M   67.7M   68.5M   68.6M   67.8M   67.7M   67.7M
               DataFrame      10     float   69.4M    67.8M   67.9M   67.7M   68.5M   68.6M   67.8M   67.8M   67.7M
               DataFrame     1000     int    69.6M    67.8M   67.9M   67.7M   68.6M   68.7M   67.8M   67.8M   67.7M
               DataFrame     1000    float   70.4M    67.7M   67.8M   67.8M   68.6M   68.5M   67.8M   67.8M   67.7M
                 Series       10      int    72.5M    70.1M    70M    70.1M   71.7M   73.4M    70M    70.1M    70M
                 Series       10     float   72.5M    70.1M   70.1M    70M    71.7M   73.4M    70M     70M    70.1M
                 Series      1000     int    72.6M     70M    70.2M   70.1M   71.7M   73.4M    70M    70.1M    70M
                 Series      1000    float   72.6M    70.1M    70M    70.1M   71.6M   73.3M    70M     70M    70.1M
              ============ ======== ======= ======== ======= ======= ======= ======= ======= ======= ======= =======

[ 45.00%] ··· rolling.VariableWindowMethods.peakmem_rolling                                                                                                                                               ok
[ 45.00%] ··· ============ ======== ======= ======== ======= ======= ======= ======= ======= ======= ======= =======
              --                                                             method
              ----------------------------- ------------------------------------------------------------------------
               contructor   window   dtype   median    mean    max     min     std    count    skew    kurt    sum
              ============ ======== ======= ======== ======= ======= ======= ======= ======= ======= ======= =======
               DataFrame     50s      int    69.5M    69.6M   69.6M   69.6M   70.3M   69.5M   69.6M   69.5M   69.6M
               DataFrame     50s     float   69.6M    69.6M   69.6M   69.6M   70.3M   69.5M   69.5M   69.6M   69.5M
               DataFrame      1h      int    69.7M    69.5M   69.6M   69.6M   70.4M   69.5M   69.6M   69.6M   69.6M
               DataFrame      1h     float   69.6M    69.5M   69.6M   69.5M   70.3M   69.6M   69.5M   69.6M   69.6M
               DataFrame      1d      int    74.4M    69.5M   69.7M   69.7M   70.4M   69.5M   69.6M   69.6M   69.6M
               DataFrame      1d     float   73.7M    69.6M   69.7M   69.8M   70.4M   69.5M   69.6M   69.5M   69.5M
                 Series      50s      int    71.1M    71.2M   71.1M   71.1M   71.9M    71M     71M    71.1M   71.1M
                 Series      50s     float   71.1M    71.1M   71.1M   71.1M   71.8M    71M    71.1M    71M    71.1M
                 Series       1h      int    71.1M    71.1M   71.1M   71.1M   71.9M   71.1M   71.1M   71.1M   71.1M
                 Series       1h     float   71.2M     71M    71.1M   71.1M   71.9M    71M    71.1M   71.1M   71.1M
                 Series       1d      int    73.9M    71.1M   71.2M   71.2M   71.8M   71.1M   71.2M    71M     71M
                 Series       1d     float    73M      71M    71.2M   71.2M   71.9M    71M     71M     71M    71.1M
              ============ ======== ======= ======== ======= ======= ======= ======= ======= ======= ======= =======

@mroeschke mroeschke added Benchmark Performance (ASV) benchmarks Window rolling, ewma, expanding labels Sep 2, 2019
@WillAyd
Copy link
Member

WillAyd commented Sep 2, 2019

Do you know how much memory is used by the rolling op versus the setup here? I think peakmem will include setup so might be desirable to use setup_cache or configure some other way

https://asv.readthedocs.io/en/stable/writing_benchmarks.html#peak-memory

@jreback jreback added this to the 1.0 milestone Sep 2, 2019
@mroeschke
Copy link
Member Author

I created a separate class locally for memory benchmarks and the peakmem results look similar.

class MethodMemory:
    def setup_cache(self):
        N = 10 ** 5
        arr = 100 * np.random.random(N)
        roll = pd.Series(arr).rolling(1000)
        return roll

    def peakmem_mean(self, roll):
        roll.mean()

$ asv dev -b rolling

[ 32.14%] ··· Setting up rolling.py:126                                                                                                                                                                   ok
[ 32.14%] ··· rolling.MethodMemory.peakmem_count                                                                                                                                                       72.7M
[ 35.71%] ··· rolling.MethodMemory.peakmem_max                                                                                                                                                         69.5M
[ 39.29%] ··· rolling.MethodMemory.peakmem_mean                                                                                                                                                        69.5M
[ 42.86%] ··· rolling.MethodMemory.peakmem_median                                                                                                                                                      72.7M
[ 46.43%] ··· rolling.MethodMemory.peakmem_std                                                                                                                                                         71.1M
[ 50.00%] ··· rolling.MethodMemory.peakmem_sum                                                                                                                                                         69.5M

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for checking lgtm

@mroeschke mroeschke merged commit ae93c23 into pandas-dev:master Sep 3, 2019
@mroeschke mroeschke deleted the add_rolling_mem_benchmarks branch September 3, 2019 05:04
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Benchmark Performance (ASV) benchmarks Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants