Actually it depends:

sage: def build():
....:     v = vector(ZZ, 1000)
....:     for i in range(1000):
....:         v[i] = Integer(i)
....:     return v
....: 
....: 
sage: def build2():
....:     l = list()
....:     for i in range(1000):
....:         l.append(Integer(i))
....:     return vector(ZZ, l)
....: 
....: 
sage: timeit('build()')
625 loops, best of 3: 647 μs per loop
sage: timeit('build2()')
625 loops, best of 3: 926 μs per loop
sage: timeit('build()')
625 loops, best of 3: 653 μs per loop
sage: timeit('build2()')
625 loops, best of 3: 922 μs per loop

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/956cd852-cb0e-478d-8591-2e0dbbd3489dn%40googlegroups.com.

Reply via email to