git: c5f24f5e0db2 - main - loader: ip: Do not call getsecs so much
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Dec 2021 10:53:22 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d
commit c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-12-09 14:46:39 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2021-12-16 10:50:36 +0000
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
---
stand/libsa/net.c | 5 ++---
1 file 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;
}