You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm working with some big numbers operations. In other cases v is extremely faster than Python and close enough for me to C. However, with those big number operations Python is faster than v and it is crushing difference. First - powers:
this took only 39.75s.
I've checked v's pow implementation for bigints and I couldn't find place for optimalization. It works as it should (using (x^2)^(n/2) "trick"). So... I checked multiplication big numbers:
importtimeimportmath { powi }
importmath.bigfnmain() {
a:= big.integer_from_int(9)
first:= a.pow(99999)
second:= a.pow(88888)
start:= time.now()
for _ in0..1000 {
result:= first * second
}
stop:= time.now()
println("time elapsed: ${(stop-start).seconds()}")
}
took only 12s. Doing the same for + operation I can conclude that bigints in Python are just "somehow" implemented with better performance.
I can transform it to feature request or if that's where it should go. I would like to make some "big computation" in v.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm working with some big numbers operations. In other cases v is extremely faster than Python and close enough for me to C. However, with those big number operations Python is faster than v and it is crushing difference. First - powers:
On my computer it took
227.2s
. Python's equivalent:this took only
39.75s
.I've checked
v
'spow
implementation for bigints and I couldn't find place for optimalization. It works as it should (using (x^2)^(n/2) "trick"). So... I checked multiplication big numbers:it took
57.8
s, and equivalent for Python:took only
12
s. Doing the same for+
operation I can conclude that bigints in Python are just "somehow" implemented with better performance.I can transform it to feature request or if that's where it should go. I would like to make some "big computation" in
v
.Beta Was this translation helpful? Give feedback.
All reactions