More strange result.

With Firefox, the time measured with time.Since is 55μs on average, and 
with Chromium it’s on average 200μs but with a big jitter. It’s not the OS 
(Ubuntu 2.24LTS) load that changes as both browsers are running side by 
side. How can the ServeHttp processing time change (~ x4) depending on the 
browser ?  



Le lundi 28 avril 2025 à 18:28:25 UTC+2, christoph...@gmail.com a écrit :

> I have created web site with a middleware measuring the execution time of 
> requests using the time.Since(start) method. It is thus using the wall 
> time. 
>
> I see that the execution of the ServeHttp() is around 60μs. The handler is 
> a function that simply renders the login page that I benchmarked to use at 
> most 1μs. 
>
> The time difference seams huge. The server is idle and receiving only one 
> request at the time. I know that measuring execution time with a wall clock 
> on a time sharing system is not a great, but I have 8 cores and they are 
> mostly idle. I apparently don’t have a better method.
>
> I also saw a big jitter which was reduced by adding the instructions 
>
> runtime.LockOsThread()
> defer runtime.UnlockOsThread()
> runtime.GOMAXPROCS(1)
>
> But I still see the big execution duration. 
>
> Unfortunately, I can’t benchmark the ServeHttp() method has the object is 
> complex (db, etc.).
>
> Is there a more precise way to measure the execution time Such big values 
> don’t seam very accurate. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/1b79e5c8-3c2c-4b43-b24e-16252dfdf3cdn%40googlegroups.com.

Reply via email to