92P4 = 71,639,296
4chars.jl
keyspace = raw"!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
chars = 3
perms = Iterators.product(fill(keyspace, chars)...) |> collect |> vec
perms |> size |> println
# perms[1000:10005] |> println
$ time julia -t1 4chars.jl
(71639296,)
real 0m0.748s
user 0m0.548s
sys 0m0.605s
$ time julia -t1 4chars.jl
(71639296,)
real 0m0.723s
user 0m0.552s
sys 0m0.576s
$ time julia -t14 4chars.jl
(71639296,)
real 0m0.681s
user 0m0.584s
sys 0m0.577s
$ time julia -t14 4chars.jl
(71639296,)
real 0m0.692s
user 0m0.769s
sys 0m0.528s
single threaded (standard python)
numpytest.py
import numpy as np
char_slot = 4
charlist = "!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
arr_char = np.array(list(charlist))
arr_add = arr_char
for k in range(char_slot - 1):
arr_add = np.char.add( np.repeat( arr_char, arr_add.shape[0]),
np.tile( arr_add, (arr_char.shape[0]))
)
print(arr_add.shape)
# print(arr_add.shape[1000:1005])
$ time python numpytest.py
(71639296,)
real 0m30.379s
user 0m30.026s
sys 0m1.296s
$ time python numpytest.py
(71639296,)
real 0m30.392s
user 0m30.106s
sys 0m1.228s
itertest.py
import itertools
charlist = "!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
charlen = 4
ls = list(itertools.product(charlist,repeat=charlen))
print( len(ls))
#print( ls[1000:1005])
$ time python itertest.py
71639296
real 0m6.348s
user 0m5.080s
sys 0m1.268s
$ time python itertest.py
71639296
real 0m6.429s
user 0m5.181s
sys 0m1.248s