Regarding execution time of simple code. #25730
Replies: 3 comments 1 reply
-
|
This was on second execution on first execution it took more than 1 minute. |
Beta Was this translation helpful? Give feedback.
-
|
I believe your attempt to find the execution time is flawed... I changed the original code to this: import benchmark
import time
import net.http
mut b := benchmark.start()
resp := http.get('https://vlang.io/utc_now') or {
println('failed to fetch data from the server')
return
}
t := time.unix(resp.body.int())
println(t.format())
b.measure('get')and the result was Of course, the time can be affected by many things, including the speed of your internet connection, the speed of your system, anti-virus, etc., etc., etc. |
Beta Was this translation helpful? Give feedback.
-
|
For me the code worked in few seconds. But... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I found below code example on https://vlang.io/
below is my version of code.
Firstly I ran the code as it is on my machine.
Then I designed above code to get execution time. What I found that this simple piece of code is taking 2544 ms. Means approx 25 to 26 sec. Could anyone explain what complex things are happening in this code that it is taking 25 sec? Why I am getting to hear that vlang is faster than c and secure when it is taking to long time for a simple task. Funny part is they mentioned this example in dropdown on front page of the website.
Beta Was this translation helpful? Give feedback.
All reactions