"freebsd-update fetch" improved efficiency. Please test if you're interested.

Slightly edited quote for relevant history:
tux2bsd said:
It isn't about "speed", it is about reducing unnecessary inefficiency. It's that simple.

My underlying goal was to get freebsd-update fetch be more efficient when there are no updates.

When there are no updates I've taken freebsd-update fetch from 15s down to 0.7s on SSD, and Raspberry Pi 3 from 1m20s down to ~1.5s.

I've reduced unnecessary inefficiency. I'm happy.

https://github.com/freebsd/freebsd-src/pull/543 I promised to share it, so there it is. ( fyi grahamperrin, jbodenmann, SirDice )
 
Last edited:
I've tackled this problem another way, it's disgusting but it works, to quote myself:

# Take freebsd-update, modify it and have it standalone as 'freebsd-update-prefire' .
# This is hideous but there's too much entangled code in freebsd-update.
# The cruft of freebsd-update could be whittled away from 'freebsd-update-prefire'
# with sufficient time, it took me about an hour to get this prototype going.

I've called my new hack job freebsd-update-prefire, run like so: freebsd-update-prefire && freebsd-update fetch install (etc)

freebsd-update-prefire does an initial probe to check if there are updates, this avoids freebsd-update's pointless disk thrashing in the bugreport above.

It's a tweak on the existing freebsd-update code, just being sensible about checking for updates prior to prematurely jumping to the next step. It's the same mechanism (checking tags at the right time) as I had prior but is now external to freebsd-update.

freebsd-update is self-entangled and monolithic and cannot be corrected internally, there are a multitude of different run modes that impact each other.

grahamperrin would be interested, maybe some other people.

If freebsd-update shits itself you need salvage that directly, freebsd-update-prefire would think you were up to date because it only sees and compares tags (grep freebsd-update for "tag").


diff file posted as a .ini because of the forums... diff is against https://raw.githubusercontent.com/freebsd/freebsd-src/main/usr.sbin/freebsd-update/freebsd-update.sh ( Latest commit e01e8f9 on 13 Feb)
 

Attachments

I've cracked it, that thing was too large to whittle into something else so I've abandoned it. Started from scratch freebsd-update-probe.sh posting it to github soon.
 
Code:
root@freebsd-dns:~ # time /root/freebsd-update-probe.sh || freebsd-update fetch install
freebsd-update-probe.sh found matching tags, no update needed.
0.067u 0.141s 0:00.60 33.3%     119+187k 0+0io 0pf+0w

root@freebsd-dns:~ # time freebsd-update fetch install
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 13.0-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 13.0-RELEASE-p10.
No updates are available to install.
76.380u 22.593s 1:31.64 107.9%  22+170k 0+0io 0pf+0w

That's on a raspberry pi 3b.
 
Back
Top