- No performance benchmark.
- Python ⟿
PEP-8 - Nim ⟿
NEP1 - Python ⟿
3.7 - Nim ⟿
0.19 - No Ofuscation, no Code-Golf.
This is to compare elegant, simple, expressive code.
| #lang racket | |
| (require (prefix-in data: "2020_data.rkt")) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (module+ day1 | |
| (define expenses (map string->number (string-split (data:day1) #:trim? #t #:repeat? #t))) | |
| (define sum-is-2020? (compose (curry = 2020) (curry apply +))) | |
| (define (part1) |
| NOTE: The imports are found by simple walking throught the AST and looking after `nkFromStmt` and `nkImportStmt` nodes. | |
| The stdlib modules are identified by simple string comparisions. | |
| This method is not entirely accurate, but it does give some indication of which modules are used and which are not. | |
| File imports (tot: 14078) | |
| 0 volatile | |
| 0 db_odbc | |
| 0 asyncftpclient | |
| 0 punycode | |
| 0 ssl |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs