-
Notifications
You must be signed in to change notification settings - Fork 40
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 a note on whether microlens-th is recommended for libraries in the README #78
Comments
I don't think it has been.
Yep! I can think of several questions off the top of my head:
|
Note that if you simply compile a module with lenses, the optimiser might remove unused code instead of optimising it further (I don't know whether it's actually possible but it seems plausible), so don't forget to export the derived lenses. Benchmarking can probably be done with bench. |
Thanks for the thoughts, this is going on my todo list. |
Make an initial experimental repo: Here are manual lenses: https://github.com/seagreen/microlens-th-experiments/blob/master/plain-lenses/src/Experiment.hs#L121 Here are th lenses: https://github.com/seagreen/microlens-th-experiments/blob/master/th-lenses/src/Experiment.hs#L122 And here are the results: https://github.com/seagreen/microlens-th-experiments/blob/master/results.txt The test sources are the most boring thing I could think of. 5 data types, each with 20 fields, nothing else (the only exception is the I've got some thoughts on the results, but take a look at the code first and let me know what you think. |
PS |
Thanks! I modified the test to call
With
|
Interestingly, in your tests the difference between manual and TH lenses is much smaller. Can you rerun them with a bigger |
Another thing to do, by the way, is to figure out how the added time depends on the number of fields vs the number of records. Does it matter if the fields are in different records, or not? |
Here are my results with
Want to push up your changes (you've got push access to the repo) and then I can rerun them with an identical setup to you? |
Right now the README helpfully suggests that library authors start with
microlens
instead ofmicrolens-platform
and add packages as needed.I'm curious if
microlens-th
is appropriate for library authors, or whether slowing down the library's compile time isn't worth the tradeoff of conveniently deriving lenses. Has how muchmakeLenses
slows down compilation been researched? If it hasn't would that be a useful thing for me to look into and contribute to the README?The text was updated successfully, but these errors were encountered: