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

Add benchmark support in shellFor #102323

Closed
wants to merge 1 commit into from

Conversation

harendra-kumar
Copy link

Motivation for this change

Benchmark dependencies are not included by shellFor unless we pass
doBenchmark = true when generating the derivation. This commit
passes doBenchmark argument from shellFor to the derivation so that
benchmark dependencies get included.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Benchmark dependencies are not included by shellFor unless we pass
`doBenchmark = true` when generating the derivation.  This commit
passes doBenchmark argument from shellFor to the derivation so that
benchmark dependencies get included.
@cdepillabout
Copy link
Member

@harendra-kumar This seems reasonable. Do you have some sort of example to prove that this is working as expected?

@harendra-kumar
Copy link
Author

@cdepillabout yes, I have been using it for a while to create a nix-shell for streamly for running the benchmarks, see this PR for the nix expression in use. My initial solution was more complex, but I gave it some soak time and it emerged to be simpler.

Copy link
Member

@cdepillabout cdepillabout left a comment

Choose a reason for hiding this comment

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

I've stared at this shellFor code a while, and I've come to the conclusion that I don't think the change in this PR is the proper solution.

I think instead what you need to do is enable doBenchmark on the packages you want benchmark dependencies for. In the example in the comment on the shellFor function, it would be p.frontend, p.backend, and p.common.

Is there some reason this isn't working?

@harendra-kumar
Copy link
Author

It does not work. I just tried it and pushed it in this commit composewell/streamly@890d966 . You can pull the repo, change branch to "nix" and try the instructions in the commit message to give it a try.

@cdepillabout
Copy link
Member

It took me quite a few hours, but I finally picked apart shellFor and figured out what was going on here.

@harendra-kumar It turns out you were right. I commented about fixing this in #102598 (comment).

@harendra-kumar
Copy link
Author

@cdepillabout thanks for working on this. I am closing this in favor of #102683 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants