-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Feature/benchmark #1457
Feature/benchmark #1457
Conversation
I like the idea of benchmarks, but have some serious concerns. For Dask and IO-bound work in general, benchmark results will vary widely depending on the hardware and (if relevant) network properties. Results will be noncomparable between SSD and HDD, local and remote network access, and in general depend heavily on the specific IO patterns and storage/compute relationship of the computer. This isn't a reason not to benchmark though, just a call for very cautious interpretation - it's clearly useful to catch some of the subtle-but-pathological performance problems that have cropped up. In short, I think benchmarks should have a very clear warnings section in the documentation, and no decision should be taken to change code without benchmarking on a variety of computers (SSD/HDD, PC/cluster, local/remote data...). Also JSON cannot include comments, and there are a number of entries that you need to update, but that's a passing concern. |
@wesm just setup a machine for dedicated benchmarking of pandas and possibly other pydata/scipy project (if there's extra capacity as expected). @TomAugspurger has been working on getting it setup. So that's potentially an option, at least for single machine benchmarks. The lore I've heard is that benchmarking on shared cloud resources (e.g., Travis-CI) can have reproducibility issues due to resource contention and/or jobs getting scheduled on slightly different machine types. I don't know how true this still is, or if there are good work arounds for particular cloud platforms. I suspect this should be solvable, though. I can certainly make an internal inquiry about benchmarking on GCP if we can't find answers on our own. |
The tests for Hypothesis take almost twice as long to run on Travis at certain times of day, so I certainly wouldn't use it for benchmarking anything! Also concerned that a dedicated benchmarking machine may lead to software (accidentally!) optimized for a particular architecture or balance of machine resources without due consideration. Maybe @wesm could investigate fault injection to (eg) slow down disk access or add latency for some sets of benchmarks? |
This is a great start! Thanks @jhamman ! Our most common performance problems are handling pandas 'oddities', like non-standard indexes. Generally when an operation that is generally vectorized becomes un-vectorized, and starts looping in python. But that's probably not a big use case for most. What are the instances others have seen performance issues? Are there ever issues with the standard transform operations, such as (addendum, I just saw the comments above): |
benchmarks/dataset_io.py
Outdated
|
||
def time_load_dataset_netcdf4(self): | ||
xr.open_dataset(self.filepath, engine='netcdf4').load() | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI the pass
statements don't do anything
Keep the comments coming! I think we can distinguish between benchmarking for regressions and benchmarking for development and introspection. The former will require some thought as to what machines we want to rely on and how to achieve consistency throughout the development track. It sounds like there are a number of options that we could pursue toward those ends. The latter use of benchmarking is useful on a single machine with only a few commits of history. For the four benchmarks in my sample
So the relative performance is useful information in deciding how to use and/or develop xarray. (Granted the exact factors will change depending on machine/architecture/dataset). |
@rabernat - do you have any thoughts on this? @pydata/xarray - I'm trying to decide if this is worth spending any more time on. What sort of coverage would we want before we merge this first PR? |
We should do this to the extent that it is helpful in driving development.
Even just a few realistic use cases can be helpful, especially for guarding
against performance regressions.
…On Thu, Jul 13, 2017 at 3:37 PM Joe Hamman ***@***.***> wrote:
@rabernat <https://github.com/rabernat> - do you have any thoughts on
this?
@pydata/xarray <https://github.com/orgs/pydata/teams/xarray> - I'm trying
to decide if this is worth spending any more time on. What sort of coverage
would we want before we merge this first PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1457 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABKS1rVPL6fCRqwi1Szmtq09chkah9odks5sNpwQgaJpZM4N74gy>
.
|
I think this a great start! I would really like to see a performance test for Regarding the dependence on hardware, I/O speeds, etc, we should be able to resolve this by running on specific instance types on a cloud platform. We could configure environments with local SSD storage, network storage, etc, in order to cover different scenarios. |
About hardware, we should be able to run these on the machine running the pandas benchmarks. Once it's merged I should be able to add it easily to https://github.com/TomAugspurger/asv-runner/blob/master/tests/full.yml and the benchmarks will be run and published (to https://tomaugspurger.github.io/asv-collection/ right now; not the permanent home) |
Thanks @TomAugspurger - see asv-runner/asv-runner#1. All, I added a series of multi-file benchmarks. I think for a first PR, this is ready to fly and we can add more benchmarks as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Just a tiny suggestion...
format=self.format) | ||
|
||
def time_load_dataset_scipy(self): | ||
xr.open_mfdataset(self.filenames_list, engine='scipy').load() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would create a separate function just for the open_mfdataset call, without load, i.e.
def time_open_dataset_scipy(self):
ds = xr.open_mfdataset(self.filenames_list, engine='scipy')
This would allow us to track the cost of reading the indices and aligning. (This is my personal bottleneck with big datasets.)
Then load
could be called in a different function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
I will merge by the end of the day if no one has any more comments. |
These are now being run and published to https://tomaugspurger.github.io/asv-collection/xarray/ I'm plan to find a more permanent home to publish the results rather than my personal github pages site, but that may take a while before I can get to it. |
Awesome, thanks @TomAugspurger ! |
cool, are these numbers coming off the pandabox? |
Yep, thanks again for setting that up.
…On Thu, Jul 27, 2017 at 11:39 AM, Wes McKinney ***@***.***> wrote:
cool, are these numbers coming off the pandabox?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1457 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIk24wmNhChH3nCVT3AGqR_Q6EHa9ks5sSL1IgaJpZM4N74gy>
.
|
Yes! Thanks @wesm and @TomAugspurger. |
git diff upstream/master | flake8 --diff
whats-new.rst
for all changes andapi.rst
for new APIThis is a very bare bones addition of the asv benchmarking tool to xarray. I have added four very rudimentary benchmarks in the
dataset_io.py
module.Usage of
asv
is pretty straightforward but I'll outline the steps for those who want to try this out:Before I go any further, I want to get some input from @pydata/xarray on what we want to see in this PR. In previous projects, I have found designing tests after the fact can end up being fairly arbitrary and I want to avoid that if at all possible. I'm guessing that we will want to focus our efforts for now on I/O and dask related performance but how we do that is up for discussion.
cc @shoyer, @rabernat, @MaximilianR, @Zac-HD