purescript / registry-dev

Development work related to the PureScript Registry
https://github.com/purescript/registry
97 stars 80 forks source link

New Solver #562

Closed MonoidMusician closed 1 year ago

MonoidMusician commented 1 year ago

My short-term goal is to introduce a public SolverError type and a private one. The private type will be what exists currently. But the public type will be meant for consuming by custom printing functions (e.g. colorful output). And then I can gradually introduce better error reporting by changing the private->public mapping without affecting consumers. (E.g. to aggregate errors across failing cases.)

thomashoneyman commented 1 year ago

I have a couple questions I’ve added as comments, but on the whole this looks good to me — a strict improvement. I’m happy to get it in and keep iterating from there.

thomashoneyman commented 1 year ago

I know you had shared some general performance notes in Discord — would you mind updating everyone about the current distribution of results? Time to solve a typical package, time to solve a pathological worst-case?

MonoidMusician commented 1 year ago

Took about an hour to solve the whole registry, package by package. Out of 11519 package versions, 1848 (16%) took more than half a second, only 189 (1.6%) took more than 1 second, and 4 took 10-20 seconds. Those 4 that took the most time are:

spec-mocha@4.0.0
justifill@0.2.0
milkis@7.5.0
toppokki@2.5.0

Would be interesting to see what makes these particularly slow at some point, but it's not critical.

Using this script in my old unmerged branch: https://github.com/purescript/registry-dev/blob/mm/best-errors/lib/test/Registry/SolveAll.purs

EDIT: if someone wants to crunch the data: https://gist.github.com/MonoidMusician/0d7548c6bd6a606110b3c4c7d9c765f8