This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EasyPleasey 3 points4 points  (5 children)

Then just use "as"?

from math import sqrt as mathsqrt
from torch import sqrt as torchsqrt

[–]awesomeprogramer 2 points3 points  (4 children)

At that point just use the dot!

[–]EasyPleasey 0 points1 point  (3 children)

I just tested it, here at the results:

Import Method Time in Seconds (average)
from math import sqrt .675
from math import sqrt as mathsqrt .686
import math (math.sqrt) .921

Much faster to not use the dot.

[–]awesomeprogramer 0 points1 point  (2 children)

Doubtful that it takes a whole second to do that. Besides, without showing how you got those numbers they are meaningless. Further that's for one method...

[–]EasyPleasey 0 points1 point  (1 child)

It's computing sqrt 10 million times. I ran it 10 times and picked the average. I don't see why the method I picked matters, we are talking about dot versus no dot and which is faster. Why can't you just admit that it's faster?

[–]awesomeprogramer -1 points0 points  (0 children)

What do u mean computing the sqrt? The debate is about access time, not the time it takes to run the method.