Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

More Anonix Win

Name: Anonymous 2011-08-07 15:31

BEHOLD!



#ifndef __ANONIXWIN_H__
#define __ANONIXWIN_H__

/* Anonix.h - A set of common functions for the Anonix operating system. Copyright: none. Public Domain. Written by Anonymous. United by one. Divided by zero. We do not forgive nor forget. Expect us. */

const int ZERO = 0;

int isequalto(int x,int y){return x==y;}
int isnotequalto(int x,int y){return !isequalto(x, y);}
int islessthan(int x,int y){return x<y;}
int islessthanorequalto(int x,int y){return islessthan(x, y) || isequalto(x, y);}
int isgreaterthan(int x,int y){return x>y;}
int isgreaterthanorequalto(int x,int y){return isgreaterthan(x, y) || isequalto(x, y);}
int isnegative(int x){return islessthan(x, ZERO);}
int ispositive(int x){return isgreaterthanorequalto(x, ZERO);}
int iszero(int x){return isequalto(x, ZERO);}
int isnotzero(int x){return isnotequalto(x, ZERO);}
int dividebyzero(int x){return x/ZERO;}

#endif

Name: CUDDERfan 2011-08-07 18:31

>>10
You have a point. I ditched the Python version and wrote echo[/echo] in Bash.

[code]#!/bin/sh
echo $@


Here are the benchmarks:

GNU

$ time echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.000s
user    0m0.000s
sys    0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.000s
user    0m0.000s
sys    0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.000s
user    0m0.000s
sys    0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.000s
user    0m0.000s
sys    0m0.000s
$ time echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.000s
user    0m0.000s
sys    0m0.000s


Anonix

$ time ./echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.005s
user    0m0.000s
sys    0m0.000s
$ time ./echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.005s
user    0m0.000s
sys    0m0.000s
$ time ./echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.005s
user    0m0.004s
sys    0m0.000s
$ time ./echo Have you read your SICP today?
Have you read your SICP today?

real    0m0.005s
user    0m0.000s
sys    0m0.000s


As you can see, the GNU version is about 5 times faster, but we'll still in the beta phase. Optimization will come later.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List