In most programming languages you have a shorter form for incrementing a value
a = a + 10; // original form
a += 10; // shorter form
a = a * 10; // original form
a *= 10; // shorter form| import Benchmark from "benchmark"; | |
| import LIVR from "livr"; | |
| import FastestValidator from "fastest-validator"; | |
| /* FASTEST VALIDATOR */ | |
| const fastestValidatorShema = { | |
| $$strict: "remove", | |
| username: { required: true, type: "string" }, | |
| gender: { type: "string", enum: ["male", "female"] }, | |
| phone: { type: "string", max: 10 }, |
| package Validator; | |
| use strict; | |
| use warnings; | |
| use Moo; | |
| use BaseValidator; | |
| use Util; | |
| our $DEFAULT_RULES = {}; | |
| our $IS_DEFAULT_AUTO_TRIM = 0; |
| import crypto from "crypto"; | |
| const NUMBER_OF_SHARDS = 100; | |
| const NUMBER_OF_ENTRIES = 100_000; | |
| const shards = []; | |
| for (let i = 0; i < NUMBER_OF_ENTRIES; i++) { | |
| const numericUUID = BigInt("0x" + crypto.randomUUID().replace(/-/g, "")); | |
| const shardId = Number(numericUUID % BigInt(NUMBER_OF_SHARDS)); |