Coder Social home page Coder Social logo

performancetesting's Introduction

dn-m

Application targets for the dn-m project.

performancetesting's People

Contributors

bwetherfield avatar ferranpujolcamins avatar jsbean avatar mossheim avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

ericsites

performancetesting's Issues

[Minor] Change inverseFunction to inverse

Following some changes we made in other places, would it be reasonable to change:

enum Complexity {
    ...
    case customComplexity(inverseFunction: (Double) -> Double)
}

to:

enum Complexity {
    ...
    case custom(inverse: (Double) -> Double)
}

In both cases (customComplexity and inverseFunction), the second word functions to expose the type (in some sense) of the value (Complexity and Function, respectively). This type is exposed inherently by the type system.

Conditionally import Glibc instead of assuming Darwin

There are several points where Darwin is imported.

-Sources/PerformanceTesting/DataSet.swift
-Sources/PerformanceTesting/Complexity.swift
-Sources/PerformanceTesting/Scale.swift

In order to serve Linux, conditionally import Glibc.

Move mapDataForLinearFit from Complexity to Benchmark

Currently, mapDataForLinearFit(_:) is on Complexity. I may be wrong, but it seems like it is more in the domain of the Benchmark than Complexity.

Instead, what if we move it to Benchmark:

extension Benchmark {
    func mappedForLinearFit(complexity: Complexity) -> Benchmark
}

Audit assertPerformanceComplexity API

First, I think we should keep the linear case under the same roof as all of the others, so that assertConstantTimePerformance is not a different public function.

Instead, for now, we should do a case let .constant = complexity { assertConstantTimePerformance(...) }

With that said, I think we could clarify the path of types.

Perhaps we could rename this to:

func assert(_ benchmark: Benchmark, isIn complexity: Complexity, minimumCorrelation: Double = 0.9)

Naming of timeClosure and benchmarkClosure

Both time and benchmark can be nouns / verbs, which can be a bit confusing.

Currently, they are being used as verbs, though they are functions with return values. Perhaps we can orient the names around the type of the return value, instead of what it takes to create that value.

Flesh out Benchmark

Currently, Benchmark is just a typealias for [(Double,Double)].

I think it could be nice to package up all of the information the performance benchmark of a single operation. The API could fall out like this:

struct Trial {
    let size: Int
    let time: Double /* Seconds */
}

struct Benchmark {
    let trials: [Trial]
    let targetComplexity: Complexity
}

Consider making Scale an enum which produces test points

Right now, there is a slight dissonance to me regarding what a Scale is, and what testPoints are. They seem to be at two different levels of abstraction, seen from the viewpoint of the function call.

What if we implemented Scale as such:

enum Scale {
    case tiny
    case small
    case medium
    case large
}

extension Scale {
    var testPoints: [Double] {
        switch self {
            case tiny:
                exponentialSeries(size: 10, from: 5, to: 100)
             ...
        }
    }
}

Consider making PerformanceTestCase instance methods free functions (remove `PerformanceTestCase`)

It seems that the instance methods on PerformanceTestCase (benchmark, assertPerformance, etc.) don't have any dependencies on the PerformanceTestCase class.

I'm not sure this will work, but it could be worthwhile to move these methods out into free functions, calling XCTAssert (which is...a macro?).

The function calls would look identical at the call site, without requiring users to subclass PerformanceTestCase. I forgot I had to subclass PerformanceTestCase myself.

Do we need the testPoint (Double) in Run / Operation closure?

It is used just a few times in SetTests, where it looks like it may be replaced with some other logic.

In trying to get rid of it, though, Swift gives me a very curious error at the location within the test:

Cannot use mutating member on immutable value: 'array' is a 'let' constant

This error or only seems to occur if the type is (inout Structure), but not (inout Structure, Double).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.