- 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.
I was drawn to programming, science, technology and science fiction | |
ever since I was a little kid. I can't say it's because I wanted to | |
make the world a better place. Not really. I was simply drawn to it | |
because I was drawn to it. Writing programs was fun. Figuring out how | |
nature works was fascinating. Science fiction felt like a grand | |
adventure. | |
Then I started a software company and poured every ounce of energy | |
into it. It failed. That hurt, but that part is ok. I made a lot of | |
mistakes and learned from them. This experience made me much, much |
#[ | |
This Nim source file is a multiple threaded implementation to perform an | |
extremely fast Segmented Sieve of Zakiya (SSoZ) to find Twin Primes <= N. | |
Inputs are single values N, or ranges N1 and N2, of 64-bits, 0 -- 2^64 - 1. | |
Output is the number of twin primes <= N, or in range N1 to N2; the last | |
twin prime value for the range; and the total time of execution. | |
Code originally developed on a System76 laptop with an Intel I7 6700HQ cpu, | |
2.6-3.5 GHz clock, with 8 threads, and 16GB of memory. Parameter tuning |
Recently I stumbled upon a post which takes a closer look at the yes
command line tool. The main purpose of it is to write endless stream of a single letter y
at a ridiculous speed.
On the first glance this seems like a really simple problem, just two lines of Nim and you're done, right?
while true:
echo "y"
And indeed, this gives us plenty of y
's. But when we take a look at the write speed..
" :source this file in your "main" nim file to activate. | |
" You can run :source again to switch main file or when nimsuggest crashes. | |
" You can also :call nimsuggest#run('use') to see all uses of the thing your | |
" cursor is on. | |
"call system("killall nimsuggest") | |
let nimsuggest_job = job_start(["nimsuggest", "--stdin", "--v2", "--debug", "--log", expand("%")], { | |
\ "in_mode" : "nl", | |
\ "out_mode" : "nl", | |
\ "err_io": "out", |
Toggle safe mode: gs | |
Create new file: N | |
Delete file: d | |
Rename file: r | |
New directory: K | |
Open file: e | |
Move file: m | |
Open VimFilerExplorer: e | |
Open current directory in a new buffer: dl | |
Open current directory in a new split: ds |
" Vim color file | |
" Converted from Textmate theme Predawn using Coloration v0.4.0 (http://github.com/sickill/coloration) | |
set background=dark | |
highlight clear | |
if exists("syntax_on") | |
syntax reset | |
endif |
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |