Skip to content

Added memory benchmarks to CI#864

Merged
Perryvw merged 22 commits intomasterfrom
memory-benchmark
May 11, 2020
Merged

Added memory benchmarks to CI#864
Perryvw merged 22 commits intomasterfrom
memory-benchmark

Conversation

@lolleko
Copy link
Copy Markdown
Member

@lolleko lolleko commented May 5, 2020

For a preview of the results see: https://github.com/TypeScriptToLua/TypeScriptToLua/runs/653550386

From benchmark/README.md:

TSTL Benchmarks

These benchmarks are written in typescript and transpiled to lua by using tstl.

Currently only memory benchmarks are supported

To add a new benchmark add a new file to memory_benchmarks
and default export a function with the following type: () => void.

For example (memory_benchmarks/my_benchmark.ts):

export default myBenchmark() {
    cont n = 123;
    for (let i = 0; i < n; i++) {
        // Do something memory instensive
    }
}

Goal

The goal of memory benchmarks is to track how much (memory) "garbage" is created by tstl.
For that reason garabage collection is disabled in the benchmarks.

You can force the creation of "garbage" by creating a lot of anonymous functions or temporary tables (see lua-users.org for more information).

To avoid crashes in the CI your benchmark should not use more than 500MB of memory.

Running locally

  1. Create a benchmark baseline called "benchmark_baseilne.json":
    tstl -p tsconfig.53.json && cd dist && lua -- run.lua benchmark_baseilne.json
  2. Make some changes to tstl.
  3. Create an updated benchmark and compare with the baseline:
    tstl -p tsconfig.53.json && cd dist && lua -- run.lua benchmark_updated.json benchmark_baseilne.json
  4. The above command will output comparison data as json to stdout.
    If you provide a path as third argument the comparison data will be written to that path instead.
    tstl -p tsconfig.53.json && cd dist && lua -- run.lua benchmark_updated.json benchmark_baseilne.json result.md

@lolleko lolleko force-pushed the memory-benchmark branch from b62f733 to d09436e Compare May 7, 2020 10:23
lolleko added 3 commits May 7, 2020 17:33
Fixed popen behaviour
Improved error handling
Fixed tslint issues
Reverted lua-types dev version back to jit

**Running locally**

1. Create a benchmark baseline called "benchmark_baseilne.json":
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Create a benchmark baseline called "benchmark_baseilne.json":
1. Create a benchmark baseline called "benchmark_baseline.json":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there are a lot of these copy pasted here.

@Perryvw Perryvw merged commit 0da1b35 into master May 11, 2020
@Perryvw Perryvw deleted the memory-benchmark branch May 11, 2020 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants