diff options
author | Emmanuel Vadot <manu@FreeBSD.org> | 2021-12-09 14:46:39 +0000 |
---|---|---|
committer | Emmanuel Vadot <manu@FreeBSD.org> | 2021-12-16 10:50:36 +0000 |
commit | c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d (patch) | |
tree | f91ac84db211800f2cafebf406d3511d929c539d /stand | |
parent | 4f36ed513cc8fc3fe780b23ecda8cb1fdc6edf7d (diff) | |
download | src-c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d.tar.gz src-c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d.zip |
loader: ip: Do not call getsecs so much
getsecs is very costly, reuse the values we got before.
Fetching a ~30MB kernel with the tftp command use to take ~26 seconds
and now it's ~18 seconds.
Reviewed by: imp, tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33408
Diffstat (limited to 'stand')
-rw-r--r-- | stand/libsa/net.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/stand/libsa/net.c b/stand/libsa/net.c index 3142616a5bf0..e04a370e466e 100644 --- a/stand/libsa/net.c +++ b/stand/libsa/net.c @@ -101,10 +101,9 @@ sendrecv(struct iodesc *d, tmo = MINTMO; tlast = 0; tleft = 0; - tref = getsecs(); - t = getsecs(); + tref = t = getsecs(); for (;;) { - if (MAXWAIT > 0 && (getsecs() - tref) >= MAXWAIT) { + if (MAXWAIT > 0 && (t - tref) >= MAXWAIT) { errno = ETIMEDOUT; return -1; } |