You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be able to reduce the whitespace significantly, to make the file smaller. Could even collapse it to a single line, I'm not sure there's much value keeping it human-readable, but maybe @emilykl has opinions about this. If we really want to optimize file size we could also change its structure a bit - like if every entry is a dict {params, superclass} this could be converted to a length-2 list. But the whitespace is the biggest piece of this.
json.load is pretty fast, ~41ms on my computer. But it's even faster if we just make this a Python file. In my quick test I just added:
true=True
false=False
null=None
v =
to the beginning of the file to convert the JSON to Python, and then from validators._validators import v took only ~25ms. (If we do this for real we should be able to tweak the json.dump to output Python in the first place so we don't need to alias true, false, and null).
The text was updated successfully, but these errors were encountered:
@alexcjohnson wrote:
{params, superclass}
this could be converted to a length-2 list. But the whitespace is the biggest piece of this.json.load
is pretty fast, ~41ms on my computer. But it's even faster if we just make this a Python file. In my quick test I just added:to the beginning of the file to convert the JSON to Python, and then
from validators._validators import v
took only ~25ms. (If we do this for real we should be able to tweak thejson.dump
to output Python in the first place so we don't need to aliastrue
,false
, andnull
).The text was updated successfully, but these errors were encountered: