Better HN
topnewbestaskshowjobs
Log inSign up

SolarNet

1,816 karma · joined Jun 14, 2011 (15y ago) · 1,039 submissions

Submissions

comment 9y ago · link · parent

The compiler is (probably) smarter than you. Generally speaking, it will automatically decide which branches are most likely and arrange them accordingly (e.g. for things like for loops and while loops especially, where the biggest gains are). You'd likely gain more performance out of algorithmic changes, and then a number of other processor optimizations (like vectorization and pre-fetch hints) first. Also, CPU manufactures ignore the classic hints, and don't really have information on how to tune branch predictors. So while GCC/Clang does have a special intrinsic (`__builtin_expect`) for it in c/c++ - most other languages are too high level for it to matter - it probably won't do much and is an insanely early optimization to consider making.

comment 9y ago · link · parent

And that the rest of the community is supporting his alleged abusiveness (e.g. by voting to keep him on board). It's not just because they dislike him, it's because the community in general seems fine with his kind of behavior.

Not that I am supporting it, just explaining why in their view this is bigger than just him.

comment 9y ago · link · parent

I mean I'm not worrying about it at that level, just that it's something relevant to the idea of layout. C++'s templates are a powerful language feature for doing layout optimization however, and it's sort of the thing to beat in power.

comment 9y ago · link · parent

AoS is useful for things where you want to effectively have fast (e.g. no cache misses) random access to many fields; the common OO approach. SoA is useful when you want fast iteration across only a couple fields of many objects; the common simulation loop approach. Effectively what Jai allows is deciding which to use when you declare a chunk of memory.

A lot of concerns I have can all theoretically be fixed in user space, on the other hand the same can be said for any language, and hence sort of defeats the purpose of a keyword. The point of the keyword is that it can inspect the fields of a type and decide how many arrays of what size to allocate. Here are some issues which would be annoying to implement in user space with AoS/SoA being merely an orthogonal keyword (e.g. limited operator overloading and without Turing Complete templates or macros):

* Alignment and padding so certain fields can be loaded into specific registers. This effects the layout of memory differently in each mode.

* Multiple buffers for some fields. A heavily used field (say position) could have a number of buffers which are rotated in SoA mode (e.g. render-posistions, last-frame-step, next-frame-step; allowing for reader/writer systems), and are simply an array of fields in AoS mode. Where as other fields retain their singular arity.

* Concurrency concerns. Partitioning arrays in SoA so cores don't fight over the lower caches. Aligning AoS on cache lines so whole objects can be locked at once without causing cache problems with neighboring objects.

* Sparse fields. If a field is generally empty, space is still allocated for it (e.g. in SoA using a dictionary rather than an array), or a cache miss due to usage of a pointer.

* But to answer the actual question it comes down to data structures: If I wanted to iterate across objects in an arbitrary quad-tree node and it's children, there are efficient ways to layout memory so that that and similar useful operations are fast (e.g. minimal cache misses). Yes I could put the data-structure in a different array but then I am looking up values in the data array randomly (e.g. cache misses). Many useful data structures have efficient systems for laying out their values and their structure in the same memory.

To elaborate on the last one more, maybe I have a structure that has 4 fields, two are keys that can be structured (e.g. string name, and x,y pos), and two are are actual data members. Regardless of `AoS` or `SoA`, I would have to write custom data structures to maintain string (trie) and pos2 (quad tree) indices, that would also be doing slow lookups. Alternatively, if I could set the layout of an array to `Trie.name` (Trie using name field) I would be saying, layout this container to be as fast as possible (e.g minimal cache misses) for string based lookups by making it the primary layout, without having to change any code that uses it (you could even go the next step with something like: `SoA | Trie.name | QuadTree.pos` to allow reordering a single line of code to effect the performance of all code referencing it, but for the semantics of the line to act like normal bit flags).

tl;dr: Think database indices on columns, but improving runtime performance by rearranging the data itself into the index so as to better fit the algorithm and CPU requirements (e.g. rather than more abstract decisions in databases, where the model of a piece of hardware isn't usually a concern).

comment 9y ago · link · parent

I think that's cool, but I would almost say that's like the `const` problem of c++ and the Open System problem. It's a single special keyword. Not a point to extend with arbitrary layouts. It is progress, but a very small step.

comment 9y ago · link · parent

The idea that governs the phone systems the modern internet was born from. That providers of network access must provide access to other networks equally. That the networks are neutral to the content flowing across them. This is about preventing monopolies of the physical lines.

comment 9y ago · link · parent

Or, traveling a 100 miles takes a couple hours even if it isn't public transit, because of things like safety, traffic, and the laws of physics. Also, a click-bait headline (she leaves at 4 am).

comment 9y ago · link · parent

Cracked even ran a commentary video [0] where all the hosts misunderstood how the internet works entirely (Netflix pays millions of dollars to Tier 1 providers (pre-Comcast deal even) every year, they don't use the networks for free, and Comcast didn't build them (nor own the companies that did) they only build the last mile - which is supposed to be maintained by their subscribers, not be used as a monopoly to be greedy with - they also pay Teir 1 providers to provide connectivity and maintain the internet).

[0] https://youtu.be/EfAAHLTlhmU?t=35m30s

comment 9y ago · link · parent

The bit about the trigger was interesting. Is that software/firmware? Or is that a hardware trigger they are discussing.

comment 9y ago · link · parent

To be clear this was meant to be a tongue in cheek rephrasing to point out what was problematic about the gorilla statement and the google memo, I do not believe this.

comment 9y ago · link · parent

I don't, but I was pointing out the annoyance of such a statement. You could probably scrounge up such a paper on google scholar.

For example, black lives matter 's point was simply that some specific white people were biogted, and yet all lives matter is a thing. Which is an example of the inverse (generalizing specific complaints, vs. in this case, specifying general complaints).

comment 9y ago · link · parent

> Gorillas typically have black fur. So no gorilla can have white fur? Wat?

More like "white people are generally bigoted, but of course this doesn't apply at an individual level".

comment 9y ago · link · parent

I mean the implication we exclude the object we are searching for when we say like. If I was looking for a table row "like" the value of row 34, row 34 wouldn't be a match.

comment 9y ago · link · parent

> arrogant journalists

comment 9y ago · link · parent

These include all the commit logs. How many times did your first commit for a brand new feature need zero fixing.

comment 9y ago · link · parent

> he dresses well, has good hygiene, is educated, well off, and speaks politely

Have you seen the videos of two people, one white, and one black, who are all those things being treated radically different by various different groups?

For example: https://www.youtube.com/watch?v=jf5TEoo-EY0

It may not only because he is white, but it is a significant part of the equation. Let alone the socioeconomic things that cause educated and well off to be things that white people have greater access to.

comment 9y ago · link · parent

This is why I subscribe to internet radio instead. It's cheaper and has better discovery features. For example di.fm

comment 9y ago · link · parent

I think it is how dangerous the reaction with alcohol is. Most drugs with alcohol make you extra drunk. This one gives you a heart attack.

comment 9y ago · link · parent

> 10 new "bitcoins" could fork every day

Not really. You are forgetting how the difficulty works (or simply don't understand bitcoin).

You'd have to have a significant percentage of the bitcoin mining infrastructure. If you have 1% of the bitcoin mining infrastructure it would take 100x the time to mine a block, or 1000 mins, or basically half a day, that would take a week of not getting bitcoin simply to confirm the new chain. As it is this new coin accounts for like 5% of the bitcoin mining power.

To do 10 new forks every day would take a 70% of the bitcoin mining power to sustain for just a week.

comment 9y ago · link · parent

Because it was probably accidental. As opposed to using something like Lisp macros, where meta programming doesn't require using the type system language and shoving it into the shape you need, and is basically normal programming. Now that it's been discovered people are going to rely on the quirks that enabled it, and it's now an accidently designed meta programming language inside your type system. See C++ for why that is bad.

comment 9y ago · link · parent

Yes 51% of the branch you are attacking. They have hard forked, any bitcoin mining pool could easily control 51% (like 80%) of the bitcash mining worldwide.

comment 9y ago · link · parent

Not the OP, but I would suspect that the problem is displaying JSONB as if it were plain text json without having to deal with manually converting it or relying on DB operations.

comment 9y ago · link · parent

A dead project due to the shear complexity and obfuscation and proprietary bug/feature weirdness (e.g. undocumented relied upon in some edge case feature/bugs tend to exist in proprietary single-implementation systems) of flash.

Things like Mono took a decade to finish as an exact clone of a portion of Microsoft's implementation, and that was only possible because the people using it (the target audience begin linux programmers) could fix the code as needed. Flash's target audience is artists.

comment 9y ago · link · parent

I think his point is that when it comes to stuff like this, our intuition about reasonable assumptions is wrong. And we must as both you and the parent post say, be systematic about the response.

comment 9y ago · link · parent

Current and recent games. The poster is replying to games that haven't been in touched in 10+ years. Classic web games.

comment 9y ago · link · parent

Because it was legal. Congress repealed the law that said those actions were illegal and so it wasn't...

Checks and balances and all that: elect better representatives.

comment 9y ago · link · parent

I'm quoting you... you are arguing with your own words!

comment 9y ago · link · parent

Except he implied that the link should have a significant bias. Also there is a collapse button.

comment 9y ago · link · parent

> with a link to some canonical thread about why the concept of security laws is fundamentally unjust or unwise

Because not everyone agrees with that position.

1
171819
35