Better HN
topnewbestaskshowjobs
Log inSign up

Coding_Cat

837 karma · joined Oct 11, 2014 (12y ago) · 272 submissions

Submissions

comment 9y ago · link · parent

Well, overeating is maybe simplified too much but it can be reduced mostly to "wrong eating". Perhaps not overeating in absolute volume but overeating of effetcive calories. There might be metabolic difference between people leading to different eating patterns working for different people, sure. But if you are obese in virtually all cases it is simply a matter of changing your diet (even for the cases that have an independent medical cause such as a thyroid disease). And in most cases the fix is to simply eat less callories in general by eating less and/or healthier alternatives.

And exercise does help you lose body fat, unless you start eating extra to compensate for the exercise as most people vastly overestimate how much calories you actually burn working out. And of course power-training that helps you build muscle mass can increase your weight but that does not mean that it is bad for you. If you're going to the gym regularlly anyway during your diet just measure your body-composition to track your effective weight. (not sure how accurate that is though).

comment 9y ago · link · parent

Go work for CERN, become a member of the personel and then meet these strict requirements: http://nic.cern/registration-policy/ , shouldn't be too hard ;)

Shame they don't let users have a homepage USERNAME.cern like how universities give you a homepage usually at uni.edu/USER/~/index.htlm (or something).

comment 9y ago · link · parent

For the Alice experiment most jobs are IO limited. Although throughput should be improved by run 3 via backend changes (I hope so at least, currently doing my MSc. thesis on exactly that...).

Simulations are compute heavy, but analysis tasks vary, with the speed of a modern processor future analysis is still likely to be IO/bandwidth limited. The ratio of RAM to core on the test server I have access to is 128/20 so 6.4 GiB per core.

But for (future) analysis the plan is to use, or at least try to use, shared memory and grouping users tasks together based on the required data (They speak of an analysis train with wagons). So a large part of the ram requirements, namely the backing data, should be shared among the cores. I think ideally there will be a top-level scheduler for each node which tries to minimize the required bandwidth (but that is outside the scope of my work so who knows how it's implemented). With a few "best practices" it should be possible for most analysis to consume a 'reasonable' amount of memory at any given time in that case.

comment 9y ago · link · parent

Yeah, this will affect any language that stores structs as POD (plain old data) as long as it has somewhat sensible alignment rules and allocation (i.e. doesn't hide every struct behind a pointer, doesn't align char's to 8 bytes).

comment 9y ago · link · parent

>Sorry, I don't quite understand the explanation...

define a

  struct S{char flag, data[63];}
  
then do

  foreach s in std::vector<S>(big number){
    if s.flag == 0{ //set this variable to be very rarely 0
     do_something_with(s.data);
    }
this will load the entire struct into memory each iteration because loads from memory happen on cacheline granularity (i.e. 64 bytes at a time)

then the optimized version is

>And are you using the same number of instructions in both cases?

  //define S as struct of arrays now
  struct S{char* flags, (*data)[63];}
  s = initialize_S(big number);
  for(i = 0; i < big number; i++){
    if s.flags[i] == 0{ //set this variable to be very rarely 0
     do_something_with(s.data, i);
    }
This one will load 64 flags into the L1 cache at a time. because the L1 cache is much much faster than main memory access time will be ~64x faster for the checking of the flags. Because it is rare for the loop to enter the if, this means the overal speed will be ~64x faster. As proven by the graph I posted where it is about 16x faster (because I use an int instead of a byte as flag).

Syntax is slightly different between SoA and AoS, but functionally they are the same except for how multiple S's are laid out in memory.

>And are you using the same number of instructions in both cases? >Note also: If you are moving data structures of different sizes, you are not using the same number of instructions(calculations), as the challenge required.

The same number of instructions is an arbitrary and impossible task. I'm not going to handwrite assembly for some internet points, I only do that for fun ;). Do they perform the same amount of cpu work though, yes. They are functionally the same and use the same types of instructions. That's about as good as anyone can get it. In any case, the program is completely limited by memory throughput not computation. I could make one of the inner loops a sqrt and the other a nop and the difference would be the exact same.

If you really want to see it in assembly to prove it uses the same amount of instructions, then it's just a mov rax, [rcx], cmp rax, r8, je INNER_FUNCTION, inc rcx {sizeof(S),1} depending on the method. Add 0x90 where appropriate to match instruction counts. The rest is left as an exercise to the reader.

comment 9y ago · link · parent

I think the real issue here is that yes, people are probably born into some kind of sexuality, but the standard binary distinction of gay and straight (or even bi) doesn't really work that well.

People can be more or less attracted to one gender than the other. For some this shows up as 100-0 or 50-50 others it's 70-30. To put it crass, someone could be a really slutty straight person but also a very picky gay person.

The whole "born this way" issue I think stems from semantics of "you can be anything you want". I think a lot less people fall into the 100-0 category then they let on but because of societal pressures they don't chose to express or explore a different side (historically this also seems to be reflected). Saying someone can be what they want in that context means that they should feel free to express/explore those curiosities not that they are not innate to them as a person.

And some people just say what they feel is the best thing, not giving it much rational thought, too.

comment 9y ago · link · parent

I'll take that challenge. Here's how to do it, with a little bit of sneaky interpretation of 'memory layout':

have an algorithm which takes a large struct S and looks at a subset Sf to determine what to do with S, for some value of Sf use all of S, otherwise skip it. (e.g. when distance between 2 particles < threshold, calculate force).

Now have a very low pass-rate for the filter so that total time ~= time taken to read all of Sf. Make Sf a single byte and S >= 64 bytes (page size if you really want to beat it).

And now compare array-of-struct vs struct-of-array ;). You should see ~64x performance difference in the assymptotic case.

AoS will use one byte per cacheline read. SoA will use 64 bytes per cacheline. if you're memory bound this will translate to an almost 64x speed difference. There are other ways to achieve the same effect but that is the gist of getting 64x performance. using 1 byte vs 64. if you want to go really crazy, use a single bit and a bitfield array for the SoA. If you use a bitfield the passing chance doesn't have to be that low.

I happened to have to present on AoS vs SoA today so I have a less extreme benchmark to show the difference (~16x because it filters over 32 bit ints)

http://imgur.com/a/HuXFR

comment 9y ago · link · parent

I've found that the premium depends on the store and model. Some seem to do relative pricing, others absolute. In the latter case, if you want a big rig it's best to let someone build it for you.

Often times in those cases you also get great service because a) if you build PCs for a living you're a computer geek and it's fun to build an insane PC and b) they often use their biggest systems as advertisement. At least, that's what I've seen.

+cable management is like black magic to me. If I were to take the money saved as payment for me to get it as nice as those places get it, I'd be below minimum wage.

comment 9y ago · link · parent

People are always asking on here "what are some inefficiencies a startup needs to tackle" and I think this is a great example: Hospital support software.

From what I've heard and seen it's a total nightmare across the globe in almost every use-case. Just having a way for doctors and nurses to put all information in one clear place while also combining with the infrastructure to enforce certain information (e.g. when medication is retrieved from storage, for who is it, and was it pre-approved) to help prevent things as double-dosing (or forgetting to dose).

Doesn't sound easy tbh, but if you want a challenge here it is.

comment 9y ago · link · parent

nullptr, I believe, is compatible with C interfaces (as is simply passing 0) while not suffering from the issues described here.

comment 9y ago · link · parent

Can't they just pay boringCorp Ltd. in Bitcoin for use of their "bussiness solution" (that is managing your infrastructure or providing the bitcoin transaction platform). The boringCorp Ltd can cash out for ActualMoney(tm) and I'm sure there is some way of accounting to get that money back to where it needs to go.

comment 9y ago · link · parent

parse() is generic over it's return type (which is Result<F, F::Err> where F: FromStr) [1]. The value of which can be inferred.

The result of parse().unwrap() is of type F, which means addr is of type 'F'. afterwards when we call `let sock = TcpListener::bind(&addr, &handle).unwrap();` the compiler can infer from the signature of `TcpListener::bind`[2] what F has to be, namely `std::net::SocketAddr`

[1] https://doc.rust-lang.org/std/primitive.str.html [2] https://tokio-rs.github.io/tokio-core/tokio_core/net/struct....

comment 9y ago · link · parent

AFAIK this is not quite right. They take only 1/4th of a cycle on average, but that is because of pipelining. if you have a dependency on the result of an ALU you will still have to wait the full latency (1 cycle) before you can continue.

This makes sense as the clock is also somewhat of the 'driving force' for pushing signals through the chip from one part to the other. (some architectures have 'zero cost' operations I believe, but these are usually baked into the pipeline and have to be turned on-or-off depending on need).

comment 9y ago · link · parent

Depends. Europe is not a single country, it's impossible to answer this question. (unless in the case where you can in every country, but I wouldn't know).

comment 9y ago · link · parent

>the entire lookup table fits in L1 cache you can treat KIND_TABLE[id] as only taking ~1-2 cycles.

You can do so, but on modern processors it's ~4 cycles to access the L1 cache and

        return 175 & id & ((id ^ 173) + 11)
takes 3 cycles (cylce 1, do the first & and the ^; cycle two, do the +; cycle 3, do the second &).

comment 9y ago · link · parent

>I co-wrote a book on user acquisition and co-created an accompanying video course to climb out of debt left over from a failed startup.

I hope the startup didn't fail because it couldn't attract users?

comment 9y ago · link · parent

I think Fnangle is an abstraction over futures. The selling point I found when looking at Tokio (rust equivalent, references Fnangle) was that you write a driver for each backend and then have generic services to implement things such as timeouts. So you can reuse the timeout code for your network queries and your db queries.

comment 9y ago · link · parent

Well, there is always a mens-rea argument. If Amazon wants to offer this type of store and the technology fails to pick something up you can't really be faulted for not paying for it (without noticing).

comment 10y ago · link · parent

Could you elaborate? I thought the difference between leptonic and hadronic colliders was only in the beam & resulting signal purity?

Smashing an electron and a positron together produces pure energy to be converted into matter. It could generate photons or it could generate Hadrons just as likely could it not (as long as all quantum numbers are conserved)?

comment 10y ago · link · parent

So you would have been fine if this article was posted here on the day it was written instead? That's a bit arbitrary because the story itself is much older than five years and wouldn't have been "news" than either.

comment 10y ago · link · parent

Honestly, I'd quite like to have a world with a few large 'nation-states' in charge of 'the global scene'. I am not an economic liberal by any means, but I am a proponent of forming ties between nations and having democracy applied to smaller communities.

comment 10y ago · link · parent

Per dollar, AMD performs much better than nVidia for a significant number of cases[1] and they have much larger memory. However, this is comparing an equally optimized implementation. Unfortunately nVidia simply has much more optimized content availible.

https://streamcomputing.eu/blog/2016-05-06/noticeable-proces...

comment 10y ago · link · parent

Although it would have the interesting effect of making the price more known by association, thereby increasing the 'protection' offered to all other recipients of the price.

comment 10y ago · link · parent

For those whose algebra is rusty:

Let y = ax^n

Then log(y) = log(a

x^n) = log(a)+log(x^n) = log(a) + log(x)*n

i.e. and equation for a line when plotting log(y) vs. log(x).

comment 10y ago · link · parent

Well, the glorious leader does seem to be getting quite... globious in recent years.

comment 10y ago · link · parent

Perhaps they are not a troll, in that they don't trawl. But look at the patents that they used in their dispute with Samsung. They have no problem using their ass-backwards patents agressively if one becomes a threat to them.

comment 10y ago · link · parent

I don't now if it fixes it per se, but it does make it harder to mess up. For example, it does not automatically convert between sizes (usize) and unsigned integers (u64).

comment 10y ago · link · parent

Or you know, real life. It's just a matter of priorities (and game theory).

comment 10y ago · link · parent

What is to stop the Government from saying "we will buy this medicine at X$", where X is a fair price they could negotiate. And if negotiations fail just go "right, you are taking X$, or we are taking your patent in the name of public intrest".

I know this is a big no-no in American culture (and other parts of the world), but it is close to what say India and China are doing by ignoring patents on medicine that is needed but not affordable. To me, this is a much preferable solution to "death panels".

Some would argue that, for economic reasons, this would lead to less research or pharmaceuticals pulling out of the US market. But history has shown the opposite to be true. Again look at China and some of the heavy restrictions it puts on foreign companies there. Do they hurt their bottom-line compared to the 'American approach'? probably. Do they still turn a profit despite them? yes. And that's why many companies still try to get into the Chinese market. profit is profit and as long as they can get some, even if it's pennies, they'll stay in a market.

Let's also not forget that profits in the pharmaceutical industry are insanely high, even when taking into account the cost of research.

comment 10y ago · link · parent

There is no atmosphere and thus no wind (let alone flowing water), so no natural forces to smooth it out. On a related note, moon dust is apparently incredibly sharp for the same reason.
12345
10