Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. Duration

Duration

Apache-2.0Swift1.0.3

A Swift package for measuring and reporting execution time of operations with support for nested measurements and statistical analysis.

GitHubGitHub
325 stars14 forks0 contributors

What is Duration?

Duration is a Swift package for measuring and reporting the execution time of code operations. It helps developers identify performance bottlenecks by providing simple APIs for timing blocks of code, supporting nested measurements, and calculating statistical metrics like averages and standard deviations. The package is cross-platform and designed for practical use in Swift projects.

Target Audience

Swift developers working on iOS, macOS, tvOS, or Linux projects who need to profile code performance, debug bottlenecks, or conduct basic benchmarking.

Value Proposition

Developers choose Duration for its simplicity, lightweight design, and practical features like nested measurements and statistical analysis, making it an easy-to-integrate tool for performance testing without heavy dependencies.

Overview

A simple Swift package for measuring and reporting the time taken for operations

Use Cases

Best For

  • Profiling Swift code execution time during development
  • Identifying performance bottlenecks in nested function calls
  • Benchmarking algorithms with statistical analysis (averages and standard deviation)
  • Debugging performance issues in cross-platform Swift projects
  • Adding lightweight performance measurement to libraries or frameworks
  • Conducting iterative performance tests with multiple runs

Not Ideal For

  • Projects requiring comprehensive profiling with GUI tools or system-wide metrics like memory usage
  • Teams needing automated performance regression testing integrated into CI/CD pipelines
  • Applications that demand low-overhead, production-ready monitoring without manual code instrumentation

Pros & Cons

Pros

Intuitive API Design

Offers both start/stop calls and block-based syntax, making it easy to insert timing into existing Swift code without complex setup.

Hierarchical Performance Insights

Supports nested measurements with indented output, allowing developers to analyze performance across function call hierarchies for debugging bottlenecks.

Statistical Benchmarking

Can run multiple iterations to compute average execution times and standard deviations, revealing performance consistency and deviations in algorithms.

Configurable Logging

Allows disabling logging via logStyle settings or push/pop methods, useful for release builds or library distribution to avoid unwanted output.

Cons

Limited Data Export

Lacks support for logging measurements to data structures for external analysis, as acknowledged in the README, restricting post-processing or integration with other tools.

Basic Logging Options

Only provides .None and .Print log styles, with no built-in file output or compatibility with standard logging frameworks, limiting flexibility in production environments.

Manual Instrumentation Required

Requires explicit code insertion for every measurement, unlike automated profilers that can instrument code without modifications, increasing development overhead.

Frequently Asked Questions

Quick Stats

Stars325
Forks14
Contributors0
Open Issues0
Last commit5 years ago
CreatedSince 2016

Tags

#debugging-tools#ios#tvos#profiling#performance-measurement#linux#cross-platform#swift-package#benchmarking#macos

Built With

S
Swift

Included in

iOS51.7kSwift26.0k
Auto-fetched 18 hours ago

Related Projects

inferinfer

A static analyzer for Java, C, C++, and Objective-C

Stars15,661
Forks2,098
Last commit1 day ago
R.swiftR.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects

Stars9,569
Forks779
Last commit1 year ago
SwiftGenSwiftGen

The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!

Stars9,552
Forks765
Last commit3 months ago
XcodeGenXcodeGen

A Swift command line tool for generating your Xcode project

Stars8,642
Forks888
Last commit8 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub