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

How to C

Name: Anonymous 2016-01-08 14:23

https://matt.sh/howto-c

Very good read for anyone that wants to write this outdated language in 2016.

Name: Anonymous 2016-01-21 12:01

retro home computers
Symbolics Pascal
Are historical curiosities. I could claim "an independent strong language that need no C" because in the past it was written in assembler and was unportable mess(BASIC - the ultimate language with no C/C++ baggage because at year XXXX it was free of C/C++ code).
portable assembler.
Portability is extremely useful long-term and allows C to outlive architectures - while arch-special snowflakes die with them.

Name: Anonymous 2016-01-21 12:16

You know the preprocessor is shit, and the hacks people are doing with it are just playing with it for fun.
void.h is used in writing real code.
boost Preprocessor is used in writing real code.
Chaos/Order libraries are used in writing real code
Lisp macros are used to write single-purpose toy programs to demonstrate the superiority of lisp.

Name: Anonymous 2016-01-21 12:22

Challenge:
implement p() from void.h textio.h subheader without using macros in C.
If preprocessor "used only for fun", there should be no problem using plain C without it.
syntax
p(args...) prints arguments to stdout.
example: p(1,2.3,"LITHP") results in:
1 2.3 LITHP

Name: Anonymous 2016-01-21 17:05

>>76
What the fuck are you smoking? Even just looking at the very first benchmark:
What are YOU smoking, or rather what are you looking at?
Binary trees is here:
https://benchmarksgame.alioth.debian.org/u64q/performance.php?test=binarytrees
Lisp is ~8 times slower than C.

Name: Anonymous 2016-01-21 17:20

>>84
Even if Lisp was faster than C in one benchmark its probably non-idiomatic port of C-like code.
Stalin Scheme reaches about near C performance this way:it optimizes scheme code into a chunk of tight C code thats than compiled/optimized by GCC and reaches native C speed.
That of course doesn't make mainstream Lisp faster: its just demonstrates Lisp/Scheme compiler writers create shitty optimizers and rely on GCC/Clang/etc to clean up their mess.

Name: Anonymous 2016-01-21 17:48

>>84
Looking at those particular results, C is pulling in Apache's memory pooling library, while Lisp is doing per-node allocation for tree nodes. Not quite apples to apples. Either both should be allocating nodes on an individual basis, or both should be using pooling libraries.

Name: Anonymous 2016-01-21 17:52

>>86
while Lisp is doing per-node allocation for tree nodes.
SBCL uses a GC.

Name: Anonymous 2016-01-21 17:56

The SBCL version isn't threaded, either.

Name: Anonymous 2016-01-21 17:59

>>87
Preallocated memory avoids malloc/free in non-GC languages, and avoids alloc/gc-pressure in GC languages. It's a reasonable manual optimization in any language.

Name: Anonymous 2016-01-21 18:03

Not a single lisper bothered to write a better version.
Haskellers on the other hand target benchmarks game site in the goals. see
https://wiki.haskell.org/Benchmarks_Game

Name: Anonymous 2016-01-21 18:04

PREALLOCATE MY ANUS!

Name: Anonymous 2016-01-21 18:06

I'm certainly not going to bother writing a faster version. How many language shootout sites are there?

But certainly memory pooling + threading on a quad core box is in the realm of an 8x speedup.

Name: Anonymous 2016-01-21 18:48

>>89
If SBCL's GC does not already optimize doing lots of small allocations it's a terrible fucking GC.

Name: Anonymous 2016-01-21 21:14

>>93
It does. The allocation is a small pointer bump & check, not even a function call. However, this benchmark exercises exhausting allocation pools and free/realloc cycles, potentially forcing sbrks or multiple TLABs in any style memory system. That's kind of why it's a benchmark, and that's why pooling would give it around a 2x speedup, sidestepping the entire system that it's attempting to benchmark.

Name: Anonymous 2016-01-21 21:22

>>94
In other words: GCs are shit, and any language or implementation based on one will be slow as shit.

Name: Anonymous 2016-01-21 21:43

>>95
Non-mempooled, GC will be faster than malloc/free especially for this kind of workload the benchmark is pushing.

Mempooled, the allocator is bypassed and it's the same between languages.

Name: Anonymous 2016-01-21 23:42

who /mem-pilled/ here?

Name: Anonymous 2016-01-22 0:05

>>97
I'm /meme-pilled/

Name: Anonymous 2016-01-22 0:08

My memory of shit memes drives me to claim this spot.

Name: Anonymous 2016-01-22 0:08

...and this one, too.

Name: Anonymous 2016-01-22 21:13

>>96
A valid implementation of malloc and free are:
static char mem[~0U];
static size_t nalloc;

void *malloc(size_t n)
{
void *p = mem+nalloc;
nalloc += n;
return p;
}

void free(void *p)
{
// no-op
}

The standard imposes to real semantic requirements on these functions.
malloc() is allowed to fail at any time.

Name: Anonymous 2016-01-22 21:21

>>101
nice memory leak.

but in all seriousness, I like this code a lot. It's a great first step and it's so obvious how one could go further with it: Just add an extra array that lists all the allocated blocks and whether they're used or not - then you have copy & compact (like a GC!) every few thousand free's.

Name: !OUKY5mcbp6 2016-01-22 21:53

>>102
yeah, and then all your pointers will be invalid.
retards like you is why software is so bad

Name: Anonymous 2016-01-23 0:06

>>104
Patching them up is faster than free() on every little thing.

Name: !OUKY5mcbp6 2016-01-23 0:20

>>104
you are actually braindead

Name: Anonymous 2016-01-23 0:26

>>104
don't reply to tripfags

Name: Anonymous 2016-01-24 18:13

>>106
shut the fuck up you moron nobody gives a flying fuck about your childish imageboard drama

Name: Anonymous 2016-01-24 19:50

>>107
what are you talking about?

Name: Anonymous 2016-01-24 19:51

>>107
this is a textboard

Name: Anonymous 2016-01-25 23:57

>>108-109
``tripfags'' are the imageboard's favorite boogeymen

Name: Anonymous 2016-01-26 2:46

>>110
``tripfag''? you mean, someone who gets trips?

Name: Anonymous 2016-01-26 2:49

>>11111111111111111111111

NNNIIICCEEE TTTRRIIIPPPSSS

Name: Anonymous 2016-01-26 3:03

>>108,109
Why did you reply twice?

>>112
Who are you quoting?

Name: Anonymous 2016-01-26 3:20

>>113
oh my leg gosh EGGS DEE!!!! rofl HAHAHAH le `WHOM` are yo le queoting face XDDDDD

Name: Anonymous 2016-01-26 6:11

>>111
Nice trips

Name: Anonymous 2016-01-26 8:19

THE DEFENDERS OF THE SOUTH SQUADRON GET

Name: Anonymous 2016-01-27 10:19

>>113
being an anus

Name: Anonymous 2016-01-27 19:05

>>117
That's not what I said!

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