[cert-tools] Can schema_validator be skipped in instantiation?


#1

Hi everyone,

I am recently doing some research on the performance efficiency of cert-tools to see if there is anything can be improved. However, I found that in function create_unsigned_certificates_from_roster, the step schema_validator.validate_v2(cert) is much more time consuming than other steps (it takes up ~90% of the time consumed in the whole function, usually it takes ~2sec for one cert on my laptop).

This will not bring any side effects for producing a small number of certs, but it is definitely fatal for a large-scale certs production. For example, if I want to batch certs of several thousands of students, this step will takes more than 1 hours. To speed up this process, I have proposed two solutions:

  1. Directly remove this line schema_validator.validate_v2(cert) because I am sure that the formation of the cert is correct
  2. Turn the cache mode in jsonschema on because the most time consuming part schema_validator.validate_v2(cert) is retrieving content from several constant URLs. (However I have not found the way to achieve this)

I am wondering that is there any potential dangerous of removing schema_validator.validate_v2(cert), i.e., the first solution?

Thanks in advance!