Giter Site home page Giter Site logo

approximate-now's People

Contributors

0xflotus avatar gajus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

0xflotus ra80533

approximate-now's Issues

API access differs from that of Date

Is it intentional for the package's API access to differ from that of Date? I initially expected the package to work as a drop-in replacement of Date.now() by exporting a function by the name of now() rather than an object with a property by the name of now.

Is this something you'd allow a PR to change? I have a branch with performance increases adding up to a little over 100%. I'd like to create a PR for it but it's based on an API refactor that would close this issue.

Optimization

There's an opportunity to optimize a majority of the calculations in the library. Namely, the assignments to maxNow:

let maxNow = 50 * Math.ceil((now + 50) / 50);

let now = 50 * Math.ceil((now + 50) / 50);
let maxNow = now + 50;

  1. t0 := scale × ceil( x0scale )
    where x0 is t

  2. t1 := scale × ceil( x1scale )
    where x1 is t0 + scale

Using the definition of t0:

t1 = scale × ceil( x0scale ) + scale
t1 = t0 + scale

Regarding lock files

There isn't a lock file in this repository. It appears that you don't typically use them in any of your projects. Is there a particular reason for that? I didn't want to commit a lock file without knowing first.

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.