Coder Social home page Coder Social logo

Comments (2)

sanel avatar sanel commented on May 20, 2024

I don't think this is a bug. Notice that Clojure Ratio is lazy - actual computation will not be done until is explicitly casted or converted. Take a look at these measurements - explicit conversion adds some overhead:

(require 'criterium.core)

;; no explicit conversion
(criterium.core/bench (doall (map #(/ 1234 %) (range 2 25))))

; Evaluation count : 26816220 in 60 samples of 446937 calls.
;              Execution time mean : 2.232489 µs
;     Execution time std-deviation : 29.268225 ns
;    Execution time lower quantile : 2.217370 µs ( 2.5%)
;    Execution time upper quantile : 2.318537 µs (97.5%)
;                    Overhead used : 7.253383 ns
; 
; Found 4 outliers in 60 samples (6.6667 %)
; 	low-severe	 1 (1.6667 %)
; 	low-mild	 3 (5.0000 %)
;  Variance from outliers : 1.6389 % Variance is slightly inflated by outliers

;; explicit conversion to long

(criterium.core/bench (doall (map #(long (/ 1234 %)) (range 2 25))))

; Evaluation count : 18773880 in 60 samples of 312898 calls.
;              Execution time mean : 3.206310 µs
;     Execution time std-deviation : 39.479470 ns
;    Execution time lower quantile : 3.180998 µs ( 2.5%)
;    Execution time upper quantile : 3.310231 µs (97.5%)
;                    Overhead used : 7.253383 ns
; 
; Found 5 outliers in 60 samples (8.3333 %)
; 	low-severe	 2 (3.3333 %)
; 	low-mild	 3 (5.0000 %)
;  Variance from outliers : 1.6389 % Variance is slightly inflated by outliers

In your case, I'd explicitly convert it to desired format before you print it. The same is done for other destinations (e.g. InfluxDB) - numbers are converted before they are saved at desired precision. In between, they are flowing as lazy unevaluted number type.

from riemann.

v0lat1le avatar v0lat1le commented on May 20, 2024

I was leaning towards updating riemann.time/unix-time-real to (quot (System/currentTimeMillis) 1000)
It is also inconsistent with riemann.common.event which does (long (round (unix-time)))

from riemann.

Related Issues (20)

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.