-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #581 from samchon/features/is
- Loading branch information
Showing
431 changed files
with
1,995 additions
and
701 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { BenchmarkProgrammer } from "./BenchmarkProgrammer"; | ||
|
||
const FEATURES: string[] = [ | ||
"ObjectSimple", | ||
"ObjectHierarchical", | ||
"ObjectRecursive", | ||
"ObjectUnionExplicit", | ||
"ObjectUnionImplicit", | ||
"ArrayRecursive", | ||
"ArrayRecursiveUnionExplicit", | ||
"ArrayRecursiveUnionImplicit", | ||
"UltimateUnion", | ||
]; | ||
|
||
const LIBRARIES = (category: string): BenchmarkProgrammer.ILibrary[] => [ | ||
{ | ||
name: "typia", | ||
body: (type) => { | ||
const program = `create${BenchmarkProgrammer.pascal( | ||
category, | ||
)}BenchmarkProgram`; | ||
return [ | ||
`import typia from "typia";`, | ||
``, | ||
`import { ${type} } from "../../../../test/structures/${type}";`, | ||
`import { ${program} } from "../${program}";`, | ||
``, | ||
`${program}(`, | ||
` typia.create${BenchmarkProgrammer.pascal(category).replace( | ||
"Error", | ||
"", | ||
)}<${BenchmarkProgrammer.pascal(type)}[]>()`, | ||
`);`, | ||
].join("\n"); | ||
}, | ||
}, | ||
{ | ||
name: "typebox", | ||
body: (type) => { | ||
const schema: string = `Typebox${type}`; | ||
const program: string = `create${BenchmarkProgrammer.pascal( | ||
category, | ||
)}TypeboxBenchmarkProgram`; | ||
|
||
return [ | ||
`import { __${schema} } from "../../../structures/typebox/${schema}";`, | ||
``, | ||
`import { ${program} } from "./${program}";`, | ||
``, | ||
`${program}(__${schema});`, | ||
].join("\n"); | ||
}, | ||
}, | ||
...["io-ts", "zod", "class-validator"].map((name) => ({ | ||
name, | ||
body: (type: string) => { | ||
const schema: string = `${BenchmarkProgrammer.pascal(name)}${type}`; | ||
const program: string = `create${BenchmarkProgrammer.pascal( | ||
category, | ||
)}${BenchmarkProgrammer.pascal(name)}BenchmarkProgram`; | ||
|
||
return [ | ||
`import { ${schema} } from "../../../structures/${name}/${schema}";`, | ||
``, | ||
`import { ${program} } from "./${program}";`, | ||
``, | ||
`${program}(${schema});`, | ||
].join("\n"); | ||
}, | ||
})), | ||
]; | ||
|
||
async function main(): Promise<void> { | ||
await BenchmarkProgrammer.generate({ | ||
name: "assert-error", | ||
libraries: LIBRARIES("assert-error"), | ||
features: FEATURES, | ||
}); | ||
} | ||
|
||
main().catch((exp) => { | ||
console.error(exp); | ||
process.exit(-1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ import "./optimizer"; | |
import "./server"; | ||
import "./stringify"; | ||
import "./validate"; | ||
import "./validate-error"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { BenchmarkProgrammer } from "./BenchmarkProgrammer"; | ||
|
||
const FEATURES: string[] = [ | ||
"ObjectSimple", | ||
"ObjectHierarchical", | ||
"ObjectRecursive", | ||
"ObjectUnionExplicit", | ||
"ObjectUnionImplicit", | ||
"ArrayRecursive", | ||
"ArrayRecursiveUnionExplicit", | ||
"ArrayRecursiveUnionImplicit", | ||
"UltimateUnion", | ||
]; | ||
|
||
const LIBRARIES = (category: string): BenchmarkProgrammer.ILibrary[] => [ | ||
{ | ||
name: "typia", | ||
body: (type) => { | ||
const program = `create${BenchmarkProgrammer.pascal( | ||
category, | ||
)}BenchmarkProgram`; | ||
return [ | ||
`import typia from "typia";`, | ||
``, | ||
`import { ${type} } from "../../../../test/structures/${type}";`, | ||
`import { ${program} } from "../${program}";`, | ||
``, | ||
`${program}(`, | ||
` typia.create${BenchmarkProgrammer.pascal(category).replace( | ||
"Error", | ||
"", | ||
)}<${BenchmarkProgrammer.pascal(type)}[]>()`, | ||
`);`, | ||
].join("\n"); | ||
}, | ||
}, | ||
{ | ||
name: "typebox", | ||
body: (type) => { | ||
const schema: string = `Typebox${type}`; | ||
const program: string = `create${BenchmarkProgrammer.pascal( | ||
category, | ||
)}TypeboxBenchmarkProgram`; | ||
|
||
return [ | ||
`import { __${schema} } from "../../../structures/typebox/${schema}";`, | ||
``, | ||
`import { ${program} } from "./${program}";`, | ||
``, | ||
`${program}(__${schema});`, | ||
].join("\n"); | ||
}, | ||
}, | ||
...["io-ts", "zod", "class-validator"].map((name) => ({ | ||
name, | ||
body: (type: string) => { | ||
const schema: string = `${BenchmarkProgrammer.pascal(name)}${type}`; | ||
const program: string = `create${BenchmarkProgrammer.pascal( | ||
category, | ||
)}${BenchmarkProgrammer.pascal(name)}BenchmarkProgram`; | ||
|
||
return [ | ||
`import { ${schema} } from "../../../structures/${name}/${schema}";`, | ||
``, | ||
`import { ${program} } from "./${program}";`, | ||
``, | ||
`${program}(${schema});`, | ||
].join("\n"); | ||
}, | ||
})), | ||
]; | ||
|
||
async function main(): Promise<void> { | ||
await BenchmarkProgrammer.generate({ | ||
name: "assert-error", | ||
libraries: LIBRARIES("assert-error"), | ||
features: FEATURES, | ||
}); | ||
await BenchmarkProgrammer.generate({ | ||
name: "validate-error", | ||
libraries: LIBRARIES("validate-error"), | ||
features: FEATURES, | ||
}); | ||
} | ||
|
||
main().catch((exp) => { | ||
console.error(exp); | ||
process.exit(-1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.