Skip to content

Commit 180e990

Browse files
refactor(benches): restructure file layout (#3247)
1 parent ce0ce19 commit 180e990

File tree

23 files changed

+27
-29
lines changed

23 files changed

+27
-29
lines changed

dev-docs/CONTRIBUTING.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ The code generator lives in the [`src/generator`](../src/generator) sub-folder w
359359
The implementation that we have right now is being refactored to produce FunC ASTs and then pretty-print those ASTs as strings instead of producing source FunC code in one step. Here is the relevant pull request: <https://github.com/tact-lang/tact/pull/559>.
360360

361361
One can find the end-to-end codegen test spec files in the [`src/test/e2e-emulated`](../src/test/e2e-emulated) folder. The test contracts are located in the subfolders of the [`src/test/e2e-emulated`](../src/test/e2e-emulated) folder. Many of those spec files test various language features in relative isolation.
362-
An important spec file that tests argument passing semantics for functions and assignment semantics for variables is here: [`src/test/e2e-emulated/semantics.spec.ts`](../src/test/e2e-emulated/functions/semantics.spec.ts).
362+
An important spec file that tests argument passing semantics for functions and assignment semantics for variables is here: [`src/test/e2e-emulated/functions/semantics.spec.ts`](../src/test/e2e-emulated/functions/semantics.spec.ts).
363363

364364
Contracts with `inline` in the name of the file set `experimental.inline` config option to `true`.
365365
Contracts with `external` in the name of the file set the `external` config option to `true`.
@@ -380,13 +380,14 @@ Benchmarks are located inside `src/benchmarks/`, one directory per benchmark:
380380

381381
#### File & folder roles
382382

383-
| Path / file | Purpose |
384-
| ------------------------ | -------------------------------------------------------- |
385-
| `tact/` | Tact project that is being benchmarked |
386-
| `func/` | Equivalent FunC project that we compare against |
387-
| `<benchmark>.spec.ts` | Jest test spec that prepares and runs the benchmark |
388-
| `results_gas.json` | Aggregated gas‑consumption results, updated by the CLI |
389-
| `results_code_size.json` | Contract byte‑code size history, also updated by the CLI |
383+
| Path / file | Purpose |
384+
| --------------- | -------------------------------------------------------- |
385+
| `tact/` | Tact project that is being benchmarked |
386+
| `func/` | Equivalent FunC project that we compare against |
387+
| `test.spec.ts` | Jest test spec for contract functionality testing |
388+
| `bench.spec.ts` | Jest test spec for performance benchmarking |
389+
| `gas.json` | Aggregated gas‑consumption results, updated by the CLI |
390+
| `size.json` | Contract byte‑code size history, also updated by the CLI |
390391

391392
> **CLI support** – All commands for creating, updating, or comparing benchmarks are documented in the [Updating Benchmarks](#benchmarks) section.
392393

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
"test": "jest",
4545
"test:fast": "jest --config=./jest-fast.config.js",
4646
"test:allure": "rimraf ./allure-results && yarn test && allure serve allure-results",
47-
"bench": "yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=true jest ./src/benchmarks",
48-
"bench:ci": "yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=false jest ./src/benchmarks",
47+
"bench": "yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=true jest --testMatch=\"**/src/benchmarks/**/bench.spec.ts\"",
48+
"bench:test": "yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=false jest --testMatch=\"**/src/benchmarks/**/test.spec.ts\"",
49+
"bench:ci": "yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=true jest --testMatch=\"**/src/benchmarks/**/bench.spec.ts\" && cross-env PRINT_TABLE=false jest --testMatch=\"**/src/benchmarks/**/test.spec.ts\"",
4950
"bench:update": "yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=true ts-node src/benchmarks/update.build.ts",
5051
"bench:add": "ts-node src/benchmarks/prompt.build.ts && yarn gen:contracts:benchmarks && cross-env PRINT_TABLE=true ADD=true ts-node src/benchmarks/update.build.ts",
5152
"coverage": "cross-env COVERAGE=true NODE_OPTIONS=--max_old_space_size=5120 jest --config=./jest-ci.config.js",

src/benchmarks/escrow/escrow.spec.ts renamed to src/benchmarks/escrow/bench.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import type {
2424
Cancel,
2525
} from "@/benchmarks/escrow/tact/output/escrow_Escrow";
2626

27-
import benchmarkResults from "@/benchmarks/escrow/results_gas.json";
28-
import benchmarkCodeSizeResults from "@/benchmarks/escrow/results_code_size.json";
27+
import benchmarkResults from "@/benchmarks/escrow/gas.json";
28+
import benchmarkCodeSizeResults from "@/benchmarks/escrow/size.json";
2929

3030
const loadFunCEscrowBoc = () => {
3131
const bocEscrow = readFileSync(
File renamed without changes.
File renamed without changes.

src/benchmarks/jetton/jetton.spec.ts renamed to src/benchmarks/jetton/bench.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import {
3434
type JettonBurn,
3535
} from "@/benchmarks/jetton/tact/output/minter_JettonWallet";
3636

37-
import benchmarkResults from "@/benchmarks/jetton/results_gas.json";
38-
import benchmarkCodeSizeResults from "@/benchmarks/jetton/results_code_size.json";
37+
import benchmarkResults from "@/benchmarks/jetton/gas.json";
38+
import benchmarkCodeSizeResults from "@/benchmarks/jetton/size.json";
3939
import { step, parameter } from "@/test/allure/allure";
4040

4141
const loadFunCJettonsBoc = () => {
File renamed without changes.
File renamed without changes.

src/benchmarks/nft/nft.spec.ts renamed to src/benchmarks/nft/bench.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ import {
4242
storeInitNFTBody,
4343
} from "@/benchmarks/nft/tact/output/collection_NFTItem";
4444

45-
import benchmarkResults from "@/benchmarks/nft/results_gas.json";
46-
import benchmarkCodeSizeResults from "@/benchmarks/nft/results_code_size.json";
45+
import benchmarkResults from "@/benchmarks/nft/gas.json";
46+
import benchmarkCodeSizeResults from "@/benchmarks/nft/size.json";
4747

4848
type dictDeployNFT = {
4949
amount: bigint;
File renamed without changes.

0 commit comments

Comments
 (0)