GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TypeScriptToLua/benchmark at master · TypeScriptToLua/TypeScriptToLua

Expand file tree

/

benchmark

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

benchmark

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
README.md
README.md
 
 
tsconfig.53.json
tsconfig.53.json
 
 
tsconfig.jit.json
tsconfig.jit.json
 
 
tsconfig.json
tsconfig.json
 
 

README.md

Outline

TSTL Benchmarks

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

Memory benchmarks

To add a new benchmark add a new file to memory_benchmarks and default export a function with the following type: () => void. To prevent the benchmark from reporting "useful" results of your benchmark function as garbage, simply return the result. The memory used by the returned result won't count towards the total garbage amount.

For example (memory_benchmarks/my_benchmark.ts):

export default function myBenchmark() {
  const n = 123;
  const result = [];
  for (let i = 0; i < n; i++) {
    // Do something memory instensive
  }
  return result; // Return results so they wont be counted as garbage
}

Goal

The goal of memory benchmarks is to track how much (memory) "garbage" is created by tstl. For that reason garbage 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.

Runtime benchmarks

To add a new runtime benchmark (execution time), add a new file to runtime_benchmarks and default export a function with the following type: () => void.

Running locally

  1. Create a benchmark baseline called "benchmark_baseline.json": tstl -p tsconfig.53.json && cd dist && lua -- run.lua benchmark_baseline.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_baseline.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_baseline.json result.md
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.