Pre-compile Message validator

Use a script to pre-compile the validator for the Message class to
reduce the loading time for ctl by about 40ms.
This commit is contained in:
Hornwitser committed 2023-07-30 01:54:59 +02:00
1 parent ae542e9501
commit 5eb91be6fb
5 files changed
+36 -2

No files matched your search

+3 -2
View File
@@ -1,5 +1,6 @@
// Note: Run compile_validator script after making changes to this file.
"use strict";
const libSchema = require("../schema");
const message_validate = require("./message_validate.js");
/** @memberof module:lib */
@@ -851,7 +852,7 @@ Message.jsonSchema = {
MessageDisconnect.jsonSchema,
],
};
Message.validate = libSchema.compile(Message.jsonSchema);
Message.validate = message_validate;
/** @memberof module:lib */
class PingRequest {