-
Notifications
You must be signed in to change notification settings - Fork 115
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
Support uploading filtered paths to the store #755
base: master
Are you sure you want to change the base?
Conversation
Derivations can be automatically coerced to strings. They are however not strings and `isString` should return `False` on them.
Ideally, we would have this cache inside the (h)nix-store, and persist the store connection for the whole session. Consider this a proof of concept that may last.
At this point everything works well. But hell, it made the code sooooo slow. --eval -E '"${(import /home/gmaudoux/projets/nixpkgs { }).hello}"' is now at 50s (from 22 before). And that code does not even use nar streaming, which is the very reason why the code is so complicated. The obvious solution is to use a handler. But we may also get good performance with effect systems, where all the hype is ATM :-). Unless someone has good insights on how to use mtl stacks correctly. My intuition tells me that there is something very wrong about the implem in this PR. @bqv Fun stuff is also happening here, and in the sibling hnix-store PR haskell-nix/hnix-store#72 |
I made a second pass over this code, and I cannot reproduce the slower code issue. Here is a benchmark I made with four setups. Note that the first two cannot upload filtered paths to the store, because they cannot evaluate a nix expression (the filter function) while streaming the NAR to the store).
The conclusion is that dedaerht is 10-20% faster than threaded. it is also the only implementation that beats store-remote-restart, which tells that it is possible to make things so wrong that they are slower that starting a socket connection each time... I remains unsure about the benchmarks.threaded usually runs in 5.5s on my machine, and in this test it was 7.5s. This is an inconsistency that bothers me a lot. The machine has tons of ram, and a recent CPU, and yet running the same git revision twice does not yield identical results. Are GHC build non-deterministic. Is there a time limit to GHC optimization phases. This remains unclear.
This is not the expected gain. My next move is probably going to be an iplementation of all of this stuff with https://github.com/arybczak/effectful, as the monad transformers we use are trivial. |
Oh, and that means that all the implementations are about 42 times slower than nix-instantiate. Is that a progress over last time ? I think so :-). Thanks @Anton-Latukha for your optimizations of the code. |
Well, I did not do the optimization per say, but an organization & refactoring and some basic literal type design. I just as also could increase some laziness somewhere, while also GHC may have an easier time optimizing & fusing away some parts of the code after all the refactoring. I hoped that having a pretty clean refactored codebase would make contributions easier. I do not require anyone to follow the coding style :P. Sorry, that codebase was desynced from the PR so much. & that the CI got broken, I found difficulty in debugging undocumented changes to Nix & debugging its C++ code to make it work. |
In this PR is implementation of |
As always. I do not think about performance, having the functionality & tests is more important. After the code works, the performance can be reached. |
The PR uses unknown
Thankfully data type information is fully contained in: pathTypeStr :: PathType -> (NValue t f m)
pathTypeStr = nvStr . principledMakeNixStringWithoutContext . \case
Regular -> "regular"
Directory -> "directory"
Symlink -> "symlink"
Unknown -> "unknown |
The |
Courtesy of `layus`, ported from implementation in haskell-nix#755.
Courtesy of `layus`, ported from implementation in haskell-nix#755.
Also seems like successfully ported |
Courtesy of `layus`, ported from implementation in haskell-nix#755.
This refactors the store to make it composable with arbitrary mtl monad stacks, with the added constraint that
addToStore
takes a filtering fucntionFilePath -> PathFilter -> m Bool
which is not MonadBaseControl compatible, and cannot be lifted (the monad is in a negative/contravariant position).The solution involves a RemoteStoreT transformer, a MonadRemoteStore monad and still lacks a proper generic MonadStore which I would like to make generic across all the store implementations (in-memeory / read-only / remote daemon / etc.)
Possibly doing something very wrong here, but it works.
based on top of #554