fsprojects / fsprojects/FSharpPlus

Stopwatch: measure function execution time

Open
#470 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
941
Forks
106
PR merge metrics
No merged PRs in 30d

Description

I discussed this idea with @gusty once on the fssf Slack, but just wanted to know if this could be relevant for the scope of FSharpPlus.

Lss,

[<RequireQualifiedAccess>]
module Stopwatch

open System.Diagnostics


let measure f =
    let stopwatch = Stopwatch.StartNew()
    let r = f()
    stopwatch.Stop()
    (r, stopwatch.Elapsed)

It's a simple helper, so not sure it is worthwhile to add it to the library

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed F# Stopwatch module and measure function in the issue body, then inspect FSharpPlus conventions for small helpers and existing tests. Confirm whether this belongs in the library and, if accepted, define completion as an implemented helper with coverage for returning both the function result and elapsed time.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.