Skip to content
This repository was archived by the owner on Apr 16, 2022. It is now read-only.
This repository was archived by the owner on Apr 16, 2022. It is now read-only.

Frame rate is inconsistent in a Playground #117

@robseward

Description

@robseward

Running ProcessingKit in a playground results in an inconsistent frame rate. (MacOS)

I spent a while trying to fix this but I can't figure out what's causing the slowdown.

//: A Cocoa based Playground to present user interface

import AppKit
import PlaygroundSupport
import ProcessingKit

public class SampleView: ProcessingView {
    func setup() {
        frameRate(5)
    }
    
    var start = Date()
    func draw() {
        
        let elapsed = start.timeIntervalSinceNow
        (print(-1.0/elapsed))
        (start = Date())
    }
}

let view = SampleView(
  frame: NSRect(x: 0, y: 0, width: CGFloat(400), height: CGFloat(400))
)
        
PlaygroundPage.current.liveView = view
PlaygroundPage.current.needsIndefiniteExecution = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions