Please create an account to participate in the Slashdot moderation system


Forgot your password?
Compare cell phone plans using Wirefly's innovative plan comparison tool ×

Comment Manual loop unrolling, with goto's (Score 1) 671

Thank the language gods for gotos.

I had written this tree-traversal code that I was trying to optimize, because although it was a O(log n) solution, it was slower than the O(n) solution for many of the problem sizes I was dealing with. Unfortunately, I couldn’t just choose one or the other dynamically because the data structures were completely different. Using a pragma, I got the compiler to unroll the loop, and that helped a LOT because there was this array of constants that got nicely integrated into the unrolled loop code. While I was looking at this, I realised that there was this one branch that there was this one if condition where if it was ever executed at all, and it was true, I would bail out, while if it was executed and was false, it would never become true. So what I ended up doing was defining some macros kinda like this:

#define M1() \
if () { } else { goto the corresponding next M2 macro }


#define M2() \
label: \
  doesn’t include the if.

M2(2) ...

That just about doubled the performance. It could probably be better. Because of commonalities between the two macro expansions, LLVM thinks it’s clever and rearranges code so that I have a bit of a spaghetti of unconditional jumps. I was also getting some really weird instruction sequences, like:

lea EAX, [expression]
mov EBX, [EAX]

Why not combine those into one instruction? As far as I could tell, this value in EAX was never used for anything else. I also saw this a few times:

mov EAX, EBX
mov ECX, [expression involving 8*EAX]

Why not just us EBX directly?

I thought about reporting this as a bug, but the instant I tried to make an isolated test case, the anomalies disappeared, so what I did was separate this code into its own compilation unit (which I had planned to do anyway, wrapping it in a C++ class). Oddly, even without the code anomalies, the speed wasn’t measurably different. On a modern x86 processor, hardware instruction parallelism can slip lots of extra instruction in basically for free, especially when there are memory accesses going on that might be an L1 miss.

Comment Lawyers don’t want to deal with this crap, t (Score 3, Interesting) 93

This isn’t putting any layers out of work. How many do you think want to deal with minor parking and traffic violations? The more interesting cases are personal injury, criminal, IP, and other things where somebody has deep pockets. Heck, most of the time, people don’t involve lawyers in small claims, because it’s not cost-effective.

Who besides the ticket-writers and land lords wouldn’t be chearing for some online legal help? Actually, all the information you’d need to handle these cases was already online; all this does is automate it for you. Not to downplay this, though. Lots of apps have complicated interfaces to do things, but sometimes it’s really nice to have one of those “wizard” dialogues to help you get it started by asking all the right questions.

Comment Not causation and all that (Score 2) 100

While I’m sure that playing problem-solving games hones problem solving skills, just making your kids play games isn’t going to make them math geniuses. In fact, for most kids, it would probably just make them waste time. Rather, it is an instinctive interest in puzzles that makes some people interested in games *and* STEM subjects.

And this link is going to just be statistical. I do computer engineering, and I have side interests in math, physics, linguistics, etc. But I really don’t like most video games. My wife has degrees in english, history, and law, and she kicks my butt at every game we play.

Comment Wait, so the F-35 is good for something? (Score 2, Insightful) 343

With everything I’ve been reading lately, it sounds like the F-35 has just been a total bomb, inferior in every way to earlier planes, but for some reason I could never figure out, the air force was forced to buy them.

Why is this the first I’m hearing that it has really good stealth?

Comment Typical Republican one-sided morality (Score 1) 1017

What is it about republicans that makes them feel like it’s okay to commit any kind of crime, as long as it serves some other moral crusade they have?

Hacking is wrong and should be punished with jail time unless we’re doing it to attack the Democrats. Then it’s okay.

Lying is wrong and sinful except when creationists flat out lie to you about the evidence for evolution. Then it’s okay, because they’re on a mission to lead you to God by any means necessary, no matter how morally questionable those means would be under an other circumstances.

Comment Pill, patch, or anti-drug drug? (Score 2) 312

I think one of the things smokers find unsatisfying about things like using a nicotine patch is that they also develop a physical habit. It’s like taking a caffeine pill vs. having a cup of coffee. Sitting down with breakfast with a nice cup of coffee with cream and sugar, as with any kind of eating or drinking, causes a release of dopamine, which enhances the positive effects of the drug. Something similar happens with smoking, I assume.

If you’re actually trying to break the habit, e-cigs seem like a reasonable temporary solution, as you ease off your dosage. However, there may be other ways of doing this. For instance, you can get L-dopa (a precursor to dopamine) from Mucuna Pruriens, directly boosting your dopamine levels. Or you can take low-dose naltrexone (LDN). Naltrexone is a dopamine receptor antagonist. Large doses can be used to block the effects of addictive drugs, while low doses trigger the brain to compensate by increasing dopamine levels. You can also take tyrosine, which is a precursor to several neurotransmitters, including serotonin, norepinepherine, and dopamine.

None of them probably has quite the same emotional satisfaction that people get from the act of smoking, however.

Comment Why is the language such a big deal? (Score 1) 315

As someone who has written substantial code in enough languages that I’ve lost count, I am sortof (but not really) baffled by some people’s attitudes toward programming languages. Some are fiercely loyal to a particular language, willing to spent time bashing other languages, usually in ignorance of what people like about those other languages. Some people know only one language and live in fear for their lives that their one language will go out of style or they’ll have trouble finding work in that language. In early 2012, I didn’t know Java at all. When I found out that the language I needed to learn for a particular project was Java, I just learned it over about a month, although I did spend the next few months learning the finer points, more APIs, etc.

The reason I’m not really that baffled is that I’m this way when it comes to video games. About the only one I would ever play was Age of Empires (all versions). Recently, I’ve picked up Minecraft, but I don’t want to get completely sucked in because I have other things in my life I have to do. That being said, I’m not fiercely loyal to AoE. I just like it and played it enough to get good at. And as a life-long Lego fanatic, Minecraft appeals to me. I don’t live in fear that I won’t be able to play my favorite games.

Comment Apple doesn’t play catchup with Chrome (Score 1) 105

Safari and Chrome may have been derived from WebKit at one point. But they’ve since diverged quite a lot. Google Docs in particular caused severe memory leaks in WebKit. Those were fixed in Chrome, but Apple has never imported those fixes, so Safari web content processes will eventially eat all your memory if you leave Google Docs open for a long time.

Comment Not even released OS’s right away (Score 1) 151

Sometimes the shit doesn’t hit the fan until after the update is released into the wild. Every time a new Ubuntu or Mac OS X comes out, I read all about it and keep googling for problems that people report. After I see that most of the problems have died then, then I make off-schedule backups and then install the update.

Comment Like a tornado came through a messy child’s (Score 1) 326

My computer set up is a disheveled pile of books, monitors, laptops, opened mail, unopened mail, notepads, trash, and other assorted items. Sometimes I’m lucky to find my power adaptor and phone charging cable under the mess. I have a scanner under there somewhere, but I can’t find it. The only reason I can find my printer is because it’s down in the basement, although it too is piled up with printouts I haven’t organized yet (and probably never will).

Sometimes I wish my house were like a TARDIS inside. I could pick up the stuff I use and move to another room every time I crap up the one I’m using.

Don’t judge me. Your office is just as messy and you have fewer excuses.

Comment Re:Marriage (Score 1) 268

Religious fundamentalists are against gay marriage for the same reason that religious fundametalists believe in creationism. They interpret their holy book in some peculiar way, giving them a “truth” that is completely inconsistent with reality, and they insist on imposing that truth on you.

I saw this video where Kent Hovind and Hugh Ross argued over the age of the earth. Both are conservative Christians. Hovind insists on a literal interpretation of the Bible, while Ross is unwilling to deny solid evidence from astronomy and geology that the earth and the universe are very old. So Hovind calls Ross a HERETIC. For not denying objective evidence.

They believe that death didn’t enter the world until after sin, and sin didn’t happen until Adam and Eve, who lived about 6000 years ago. Therefore the earth CAN’T be billions of years old or else is violates a tennet of their beliefs about salvation.

The thing is, not everyone interprets the Bible in such a strictly literal way, allowing them the option to face reality. Creationists can’t do that.

So back to gay marriage, there are some Bible verses that they interpret as being anti-gay. SOME of them may have been and may have made some limited sense (to them at least) at a time when human populations were very small. Others are not clearly about homosexuality but instead seem to refer to other "perversions," like pagan fertility rites. Out of ignorance both of the scriptual meaning and its historical context, they insist on less-than-clear-cut interpretations of the Bible and declare homosexuality to be a sin.

Therefore they CANNOT accept an enlightened modern perspective on sexuality.

Christians worry about the erosion of Christianity. It’s rigid thinking like this that is the cause of Christianity’s own undoing.

Comment How, with such crappy diet and pollution? (Score 3, Insightful) 321

At the same time, we’re eating a really horrible nutrient-poor diet made up of industrial foods designed to make us want to eat more industrial foods. Plus we’ve got massive amounts of pollution from burning petrolium, hormones in the ground water, antibiotics in our foods, PBA from our food containers, and all manner of other junk ruining our health. Some people are still stuck on this bogus idea that autism is caused by vaccines, while they continue to eat a horrible diet and pollute their bodies in other ways that are much more likely to account for this measurable increase in the rate of autism (not quite explained by just an increased rate of diagnosis).

This brings up an idea that my wife pointed out. In recent history, there has been an increase in the rate of transgendered individuals. This has resulted in political polarization, where some people are demonizing them and others are saying that body dismorphic disorder is somehow a good thing. Both are wrong. People with body dismorphic disorder have every right to their dignity and to manage and adjust their bodies as they see fit. However, that doesn’t mean there isn’t an external cause, and we think a major factor is all of these hormines being pumped into the water supply. Lots of women take birth control pills, which is putting estrogen and progesterone into the water, and hormones are given to food animals. These are having an impact on development in fetuses and young children. So the next time some fundamnetalist asshole tries to tell you that there’s something BAD about people who have gender identiy issues, you can point out to them that we, as a society, did this to them. It’s our fault for poisoning the water and food. And the consequences are that more people with gender identity issues, and this is something we have to accept, and we have to treat these people like human beings and stop trying to put forth the idea that these people are crazy or making immoral choices.

Comment Re: Stop with the binary sexuality (Score 1) 354

You too are caught in the same binary thinking. The whole point of not putting yourself into a box is that you should feel free to be attracted to whomever. If you’re only attracted to males or only females, that’s fine. If you’re attracted to both, that’s fine too. What if you’re attracted to lots of females but only the occasional man? That’s fine too. This is about FREEDOM by eliminating the boxes. It’s about freedom to not be judged, freedom to make your own choices.

Let’s say, hypothetically, that there’s a genetic bias for humans to be mostly straight. What I’m trying to say is that in the future I hope it’s not considered weird for a person to have any mix of genders in sexual partners. 50/50? 90/10? 100/0? All fine. All not weird. We need to eliminate these boxes that force us into artificial categories.

Slashdot Top Deals

Why do we want intelligent terminals when there are so many stupid users?