Uploaded image for project: 'ClojureScript'
  1. CLJS-1975

Perf: Compare f with nil in Delay impl

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
    • Patch:
      Code

      Description

      When a Delay has been realized, f is set to nil. We can avoid truth_ and not calls and directly compare with nil for a minor perf boost.

      In script/noderepljs, this leads to these

      (simple-benchmark [x (delay 1)] @x 1e9)
      (simple-benchmark [x (delay 1)] (realized? x) 1e9)
      (simple-benchmark [x (doto (delay 1) deref)] (realized? x) 1e9)
      

      speeding up by 6%, 11% and 9%, respectively.

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              mfikes Mike Fikes
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: