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

Response to Torvalds (C++)

Name: Anonymous 2011-07-29 21:03

Name: Anonymous 2011-10-26 21:46

>>40
a blob programmer?

Name: Anonymous 2011-10-26 22:35

ctrl+f for "efficien" in this article.

Just goes to show: C++ is a premature optimization oriented language.

Name: Anonymous 2011-10-26 22:40

>>2
>I'm not saying that many such data containers made in C++ aren't a mess
and in the end it contradicts with itself
C++ is a mess, if you disagree you are a fag.

Name: Anonymous 2011-10-27 0:24

>>41
The term is blub programmer. Blub is a language that falls right in the middle of the abstractness continuum. It is not the most powerful language, but it is more powerful than Cobol or machine language.

As long as our hypothetical Blub programmer is looking down the power continuum, he knows he's looking down. Languages less powerful than Blub are obviously less powerful, because they're missing some feature he's used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.

I don't think in terms of languages, I think in terms of solving problems. If I assign a language for a project, it'll be the language that I can use to solve the problem as quickly as possible while giving acceptable performance when using the software.

Name: Anonymous 2011-10-27 1:31

>>44
Lisp is the bottom of the power continuum. When the Lisp programmer looks up, all he sees is merely weird languages with "syntax".

Name: FrozenVoid 2011-10-27 1:40

Lisp can be implemented in a couple of javascript functions, and it would be faster since arrays > lists and modern JIT compilers blow Lisp code out of water. In fact i can see some of my scripts approaching 40% speed of equivalent and optimized C code, that without(!) using Int32Array and typed variables(recent extension).

Name: Anonymous 2011-10-27 2:56

>>46
JS + JIT  is not going to be faster than SBCL + type hints. (I think JIT and type hints are equivalent "advantages" here)  And the guys writing Lisp compilers have it figured out, thank you very much.

But to convince your C++ poisoned mind that it's not as simple as "LOL linked lists R stoopid freshman crap not actually useful" :

let's say you implement Lisp lists as backward vectors, where the car is the last element, and the cdr is an identical array with size set to - 1 of the parent size, and cons just pushes, occasionally growing the vector by reallocating the whole thing at a new memory position. (you make it backward because idiomatic Lisp builds lisps by pushing to the front, but vectors are better at pushing to the back)

There's already a nasty performance problem here: you have to reallocate the whole array every time you cons onto something that's already the cdr of something else. For instance:


(define ngland '(n g l a n d))
(define england (cons 'e ngland))
(define angland (cons 'a ngland)) ;have to reallocate ngland because it's already got an e at the end of the array.


This isn't just some dumb example: in functional code, you pretty constantly re-use parts of data structures to build new ones, and you need to know that it's not having side effects. So the vector solution doesn't really reduce allocations, because allocations are necessary for the style. Instead, it just delays them and makes them bigger (as well as less obvious.)

Another thing this approach ruins is pointer-equality of cells. Most lisps require that lists be comparable by pointer to see if they are identical lists. If they can get reallocated, this gets complicated.

And unless you implement your arrays as not really arrays at all, like Clojure does, they kind of fall on their face at functional-style code performance-wise (as I showed above.) You need to be able to recombinate (take apart and put back together in crazy ways) them while minimizing memory allocation. That's tough with arrays. Linked lists are built for it.

Another performance issue is that cells all being the same size (typically just two pointers) is a convenient invariant to optimize around. For example, it becomes easy to write a memory manager that doesn't deallocate and rather just pushes things on a "free list." Doing so with arrays is... clumsy.


In conclusion, you have stateful brain damage.
[code]

Name: Anonymous 2011-10-27 3:26

>>47
conses are not well-adapted to today's architectures. fuck your shitty lithpu

Name: Anonymous 2011-10-27 3:38

>>48
today's architectures
you mean unmanageable, needlessly stateful, unparallelizable pieces of shit? Or are you claiming that Clojure vectors and maps are a better alternative. I don't totally disagree there.

Name: Anonymous 2011-10-27 4:33

>>49
I'm all for having various containers like list/vector/dict (with possibility of giving usage/type hints). Building everything out of cons cells sounds naive and much too simplistic to be well-adapted to reality. My mantra is to give the computer just barely enough to optimize things on its own. I can't imagine the kind of optimizer that will turn an assoc list into an optimized vroom-vroom hash table, or a mere list into a vector.

As for the Clojure thing, uh, please tell me, exactly how do you figure that having immutable vectors and maps by default is a good idea?

Name: Anonymous 2011-10-27 5:38

>C
>C++
>D
>Go

pick one

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2011-10-27 5:42

>>49
State is inherent in the universe. Not everything is parallelizable. There's a reason all the other "interesting" architectures developed back in the early days have died out.

Name: Anonymous 2011-10-27 5:48

This one single file has a whopping 8306 lines of code. As an example of a function, the fill_caches() function in this file is a whopping 462 lines long, and looks like this. (The few comments in that code are worth reading.) As an example of another function, the decode_mb_cavlc() function, which is 492 lines long and looks like this.
I have no idea what the fuck he's trying to say here. I don't understand exactly what those functions are doing, but I can at least vaguely guess what they're for. I don't know the H.264 standard and probably neither does whoever wrote that. But someone who did would most likely understand them very well.

Name: Anonymous 2011-10-27 7:49

>>52
State is inherent in the universe.
Proof?

Name: Anonymous 2011-10-27 7:56

Always nice to find a post on /prog/ where you can agree 100%, but then you realize it was you posting 2 months ago.

Name: Anonymous 2011-10-27 9:26

>>55
Imagine the same feeling, but it was you posting two years ago!

Name: Anonymous 2011-10-27 9:48

>>56
Everyone experiences that once in a while. For example, just bump a two years old post and a third of prog will feel that way.

Name: Anonymous 2011-10-27 11:06

There is no perfect programming language.

Name: Anonymous 2011-10-27 11:28

>>58
Except ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉

Name: Anonymous 2011-10-27 12:28

>>50
exactly how do you figure that having immutable vectors and maps by default is a good idea?

It makes it so you can write more things as pure functions more easily. Pure functions have so many beneficial properties that I'm not going to list them. Half of them are design benefits, the other half are performance benefits.

And Clojures maps and vectors aren't just immutable -- they're optimized for immutability.

Name: Anonymous 2011-10-27 14:19

>>60
You know, a function may do unpure things inside and still be a pure function. Forcing base containers to be immutable doesn't help that, and instead forces the programmer's hand. If you want to avoid mutating containers at all costs, then just don't do it.

Name: Anonymous 2011-10-27 14:24

>>61
If you want to avoid mutating containers at all costs, then just don't do it.
I don't do it, but the library I'm using does. What now?

Name: Anonymous 2011-10-27 15:29

>>62
You'll have to be more specific. There are some cases where mutation is preferred to returning a new object.

Name: Anonymous 2011-10-27 21:18

>>61
clojure has a means of doing impure things to all its containers within a function.  http://clojure.org/transients

Name: Anonymous 2011-10-27 21:27

>>62
If you want to avoid mutating containers at all costs, then just don't do it.

but non-functional containers make it neither easy nor efficient.

Name: Anonymous 2011-10-27 21:28

>>54
Water vapour, water, ice.

Name: Anonymous 2011-10-27 21:35

>>66
temperature is vibrating independent molecules
vibrating molecules actually according to modern quantum theory aren't really the same molecule at every point in time.

Yes the universe reallocates itself all the time.

Name: Anonymous 2011-10-27 22:26

>>65
Immutable containers make everything neither easy nor efficient.

Name: Anonymous 2011-10-27 23:11

>>68
You're brain damaged.

Name: Anonymous 2011-10-27 23:34

>>69
Okay fucktard, let's have it. I say that as long as the container behaves nicely under higher-order functions and iterators are powerful enough and certainly not retarded, they're "functional" enough.

Name: Anonymous 2011-10-28 0:26

>>70
it's not functional if I have to think about the time dimension in cases where the time dimension doesn't matter.

Name: Anonymous 2011-10-28 2:32

>>71
You are the reason why people like the antiGC guy exist.

Name: Anonymous 2011-10-28 13:17

>>72
I'm fine with that. Let em rot, I say.

Name: Anonymous 2011-10-28 16:08

>>69
What about my brain damaged?

Name: Anonymous 2011-10-29 3:13

>>74
wut

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