An open API service indexing awesome lists of open source software.

https://github.com/johennes/swift-performance-playground

Swift Playground for visualizing algorithm time complexity
https://github.com/johennes/swift-performance-playground

performance-measurement playground swift time-complexity-visualization

Last synced: 18 days ago
JSON representation

Swift Playground for visualizing algorithm time complexity

Awesome Lists containing this project

README

          

Swift Performance Playground
============================

This is a skeleton Swift Playground for visualizing the time complexity of
algorithms.

![Playground and resulting chart for two example algorithms]

Usage
-----

To see a working example, open `Performance.playground` and scroll to the
bottom. Once you run the Playground (`CMD + SHIFT + RET`), the resulting time
chart (plotting time in seconds over the input size) will start drawing in the
live view.

To test your own algorithms, customize the contents of the `Chart Display` and
`Measurements` sections.

Measurements are driven by an input data specification. The following is an
example specification that steps from 1 to 1,000,000 multiplying the current
size by 4 in each step and returning an accordingly sized randomized array of
integers.

``` {.swift}
let input = Timekeeper.InputSpec(
minSize: 1,
maxSize: 1000000,
step: { $0 * 4 }) { inputSize in
(0..