# Synth - Cheating with prefetching?



## PacketMan (Dec 3, 2016)

So I've been playing around with my ports-mgmt/synth builder server, using it with a GNOME3 profile. So of course after a week or so there are a fair few ports that have changed. As a result it will say something like prefetch 80 or 90 or so packages and rebuilding 200 or so. However I discovered something. I let it build a few dozen. Then I do a `CTRL-Q` to do a graceful shutdown. Then I rerun synth - `synth just-build` with my ports list. And ta da! It will now say it will prefetch another 150+ packages, and only build 12+. I assume I would see the same behavior using a LiveProfile and `synth upgrade-system`.

From what I can tell Synth is rock solid in getting it right when it comes to the logic of determining what to do. So am I right in thinking this method is kinda like cheating, but is perfectly okay?  if so, it would be real slick if Synth could recheck to see what can be pre-fetched after the build of each port.  I realize it would likely be really complex, but frankly marino@ I think you are up for the challenge. 

And the cherry on the top would be a slight modification to the ncurses display that shows a realtime counter for packages fetched, that would increment as Synth loops through its checking, fetching, building, checking, fetching, building, etc. Call it version 2.0.


----------



## marino (Dec 3, 2016)

you're basically manually doing the "multi-pass" algorithm I've alluded to.
In the hypothetical case that synth wants to rebuild 150 ports and when it's done, pkg(8) only updates 5 packages: using a multipass algorithm would allow synth just to build the same 5 packages.
I'm sure it would be a quite popular option.
I would consider the current behavior ultra-conservative and the hypothetical multi-pass behavior as "aggressive".

Just making up statistics, I would say you'd be fine with multipass 98% percent of the time, but every now and then some maintainer would forget to bump a package and some kind of weird error could happen.  It's just a  guess though.   This "MPA" doesn't exist with any tool, it's just an idea I have.


----------



## PacketMan (Dec 3, 2016)

marino@ said:


> Just making up statistics, I would say you'd be fine with multipass 98% percent of the time, but every now and then some maintainer would forget to bump a package and some kind of weird error could happen.  It's just a  guess though.   This "MPA" doesn't exist with any tool, it's just an idea I have.



If you're right then I'll let you know when I find it. It could be an option in your menu. Or maybe instead of an option on first run it does "MPA" and then when completed it does a 2nd "non-MPA" run to sanity check.  I know you're up for the challenge.


----------

