-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
memory_usage
to improve performance (#10537)
Refactored `Frame.memory_usage` to return a tuple of lists: (column_names, memory_usages). Motivation for this change is to remove redundent steps i.e., `dict`(`Frame.memory_usage`)->`unpack & dict` (`DataFrame.memory_usage`)->`unpack dict`(in `Series.init`). Choosing to remove `dict` being returned by `Frame.memory_usage` will now result in a 10% faster execution of external API. Not a huge speedup but it quickly adds up when `dask_cudf` is used. ```python In [1]: import cudf In [2]: df = cudf.DataFrame({'a':[1, 2, 3], 'b':['a', 'b', 'c'], 'd':[111, 123, 123]}) # THIS PR In [3]: %timeit df.memory_usage() 198 µs ± 3.44 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each) # branch-22.06 In [3]: %timeit df.memory_usage() 219 µs ± 726 ns per loop (mean ± std. dev. of 7 runs, 1,000 loops each) # branch-22.06 In [4]: %timeit dask_cudf.backends.sizeof_cudf_dataframe(df) 377 µs ± 5.67 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each) # this PR In [6]: %timeit dask_cudf.backends.sizeof_cudf_dataframe(df) 1.8 µs ± 14 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) ``` Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) - Ashwin Srinath (https://github.com/shwina) URL: #10537
- Loading branch information
1 parent
4f3ab29
commit 1355191
Showing
7 changed files
with
19 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters