Giter Club home page Giter Club logo

gendate's Introduction

gendate - Generate dates! ⌚️

List dates from January 1, 1970 (UNIX Epoch) to 3000 AD, including leap years.

Dates are printed using ISO 8601 format.

Motivation

The original shell script for generating days took several minutes, prompting a rewrite in C.
Additional implementations were incorporated to explore the problem across other languages.

Getting Started

Building

cd to src/variant, then compile with the command from table below:

Version Run with Runtime (≈)
Rust (stdlib) cargo run -r 36.6 ms
Rust (chrono) cargo run -r 45.5 ms
C make gendate && ./gendate 156 ms
Go go run gendate.go 234 ms
Tcl ./gendate.tcl 501 ms
Haskell ghc gendate.hs && ./gendate 715 ms
Python ./gendate.py 1.3 s
F# dotnet run 1.4 s
C# dotnet run 1.5 s
Scheme csi gendate.scm 1.5 s
Perl ./gendate.pl 2.3 s
Lua ./gendate.lua 3.3 s
Shell ./gendate.sh 10.5 m
All programs were measured with hyperfine.

Output

Each implementation produces output equivalent to:

$ ./gendate
1970-01-01
1970-01-02
1970-01-03
...
2999-12-30
2999-12-31
3000-01-01

Benchmarks

Variant Mean [ms] Min [ms] Max [ms] Relative
C 143.7 ± 4.4 140.5 168.9 1.00
Rust 228.3 ± 17.4 209.6 315.4 1.59 ± 0.13
Go 242.8 ± 12.2 225.1 274.1 1.69 ± 0.10
Haskell 659.5 ± 22.9 609.7 721.7 4.59 ± 0.21
Scheme 1684.5 ± 117.4 1504.4 2237.5 11.72 ± 0.89
All programs were measured with hyperfine.

License

This repository is licensed under the terms of the MIT License.

See the LICENSE file for details.

gendate's People

Contributors

neved4 avatar 0risc avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

0risc

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.