What is Nostr?
PlanB
npub15wc…qy0q
2023-05-11 21:55:37

PlanB on Nostr: dave can you please make this Python code faster (data file d.txt is ~350GB and the ...

dave (npub1tsg…htk4) can you please make this Python code faster (data file d.txt is ~350GB and the code processes ~2 billion dictionary inserts and ~2 billion pops)?

d={}
with open('d.txt','r') as f:
for l in f:
v=l.split(" ")
b,i,o=int(v[0]),int(v[1]),int(v[2])
for x in range(4+i,4+i+o):
d[str(v[x+o])]=(b,float(v[x]))
for x in range(4,4+i):
d.pop(str(v[x]), None)
print(d)
Author Public Key
npub15wcvuhts6rdj9zzhq6etru2yc6ry5ljg9zk070u0q89xk065452sjvqy0q