primitive speedup
sum price 7.7x
avg price 33x
how does this even happen though? class User{phone: ?PhoneNumber}
over class User{phone: ?string}. // C++ (naive version, sorry)
vector<int> bin(vector<int>& x, vector<int>& y) {
vector<int> r;
for (int a:x) r.push_back(lower_bound(y.begin(),y.end(),a) - y.begin())
return r;
}
# Jet
ord<<{x asc asc} # double grade idiom
bin<<{y,x ord drop len[y]-ord[x]-1}
or course this is not at all apples to apples, though it works to show the difference in possible approaches. in C++ I'm just turning an already implemented binsearch into something useable for arrays, and in jet I'm doing some weird array tricks to implement it from scratch using grade up
(asc).