Slashdot Mirror


User: Rockoon

Rockoon's activity in the archive.

Stories
0
Comments
8,765
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 8,765

  1. Re:Premature optimization is evil... and stupid on Cliff Click's Crash Course In Modern Hardware · · Score: 1

    For a small known value, though, add/shift ladders may be faster.

    This is only the case until most all instructions spend exactly 1 cycle in an execution unit. This includes shifts, adds, subs, muls, ands, ors, xors, and so on and on. Thats the state of the modern processor.

    Nearly all instructions take exactly 1 cycle to actually "execute" so there is no benefit to preferring one method over the other on an "in theory" basis. Yes, "in theory" a processors can rotate a bunch of bits very quicky and its obvious that a multiplication is much more complicated. "in practice" there is so much silicon dedicated to multiplication that it completes in the same minimum time as the shift.

    All of these instructions are 3 cycle latency on the AMD64 processors that I am familiar with (pre-phenom) and essentially the first cycle is loading the operands from the register pool into an execution unit, the second cycle is the execution, and the third cycle is retirement from the execution unit, updating the register pool. Core2's and i7's have these down to 2 cycle latency.

    Stop living in the past.

  2. Re:Premature optimization is evil... and stupid on Cliff Click's Crash Course In Modern Hardware · · Score: 4, Informative

    GCC is a big offender, thats true.

    This is one of the reasons that GCC sucks compared to ICC and VC++.

    Let me give you the facts as they are today. In isolation, both the shift instructions and the multiply instructions have the same latency and throughput, and are also performed on the same execution units.

    If this was the entire story, then they would be equal. Buts its not the entire story.

    The shift instructions only modify some of the flags in the flags register. Essentially, the shift instructions must do a read/modify/write on the flags. The multiplication instructions, however, alter the entire flags register, so only perform a write.

    "But Rockoon.. they are the same latency anyways, right?" .. yes, in isolation. But that read/modify/write cycle on the flags register prevents a hell of a lot of out-of-order execution.

    Essentially, one of the inputs to the shift instruction is the flags register so all prior operations that modify the flags register must be completed first, and no instruction following the shift that also partially modify the flags register can be completed until that shift is completed.

    In some code, it wont make any discernible difference, but in other code it will make a big difference.

    As far as that GCC compiler output.. thats code is horrible, and not just because its AT&T syntax.

    There are two alternatives here for multiplying by 4 that should be in competition here, and neither uses a shift.

    One is a straight multiplication (MASM syntax, CDECL):

    main:
    mov edx, [esp + 4] ; 32-bit version, so +4 skips the return address
    imul eax, edx, 4
    ret

    The other is leveraging the LEA instruction (MASM syntax, CDECL):

    main:
    mov eax, [esp + 4] ; 32-bit version, so +4 skips the return address
    lea eax, [eax * 4]
    ret

    The alternative LEA version on some processors (P4..), in isolation, is slower .. but it has the advantage that it uses different execution units on those very same processors, so might pair better with other stuff in the pipeline, and it doesnt touch the flags register at all.

    GCC is great at folding constants and such, even calculates constant loops at compile time.. but its big-time-fail at code generation. GCC is one of the processors that one optimization expert struggled with because he was trying to turn a series of shifts and adds into a single far more efficient multiplication.. the compiler converted it back into a series of shifts and adds on him. Fucking fail.

  3. Re:No real fix... on IE 0-Day Flaw Used In Chinese Attack · · Score: 1

    What they should be suggesting is that people not use IE on the internet (if possible) until this is fixed.

    Mozilla should do the same. Recommend against using Firefox until all known bugs are fixed.. right?

    Does that fit your world view?

  4. Re:A major security flaw in IE? on IE 0-Day Flaw Used In Chinese Attack · · Score: 1

    The reason that buffer overflow bugs crop up again, and again, and again, is because programmers insist on using unmanaged languages because they think that they are such great programmers that they are 'immune' to oversights.

    This is being said to you by an assembly language programmer, so don't for a second think that I frown on power. I use assembly when I need to, not whenever I feel like it. These buffer overflow bugs often crop up precisely because the C/C++/ASM programmer is using optimizing abstractions that are nothing *but* complicated.

    Before anyone goes off on their premature optimizations diatribe, this is an image decompressor for web pages that might have hundreds of images... optimization is a no-brainer here.. no need for profiling. Library developers exist in a different world from the application code monkeys. You can't profile future consumption of a library: faster is always better.

  5. Re:Premature optimization is evil... and stupid on Cliff Click's Crash Course In Modern Hardware · · Score: 3, Informative

    Using shift to multiply is often a great idea on most CPUs.

    Which CPU's are those? The fastest way to multiply today on AMD/Intel is to use the multiply instructions.

    Didn't know that? yeah... it seems like only assembly language programs know this.

  6. Re:Back in the days of DOS, Penn Jillette... on Challenge To US Government Over Seized Laptops · · Score: 3, Funny

    Remove the 'Press x to abort' part and it seems to me that after they see this... after they all run away... you can pick your laptop up and walk away.

  7. Re:Give me my computer glasses? on What Will Apple Do With Swedish Eye-Tracking Technology? · · Score: 2, Interesting

    wired to a set of LCD glasses

    Are you still young enough to focus on things less than an inch from your eye? I suggest that you actually try it. You'll probably be surprised that you can't. This technology would have been here a decade ago if there was a mass market for it. There isn't.

  8. Re:Someone's not doing their share! on Comcast Launches Broadband Meter · · Score: 1

    The price that the average person will bear is in fact related to their usage.

  9. Re:Someone's not doing their share! on Comcast Launches Broadband Meter · · Score: 1

    Perhaps those who aren't using anywhere near 250GB a month should start paying less.

    It doesnt work that way. They are already paying for what the average person uses. Thats what the cost is based on.

  10. Re:hmm on US Coast Guard Intends To Kill LORAN-C · · Score: 1

    200m is good enough

    hell, 1km is good enough.

    The submitter needs to learn how to use a sextant. They appear to get you about 500m accuracy.

  11. Re:Okay, let me re-phrase on Chevrolet Volt In a Gasoline-Only Scenario · · Score: 1

    I got some corn fields that might disagree with you.

  12. Re:Shamwow on Sponge-Like "Swelling Glass" Absorbs Toxins in Water · · Score: 1, Funny

    TFA: apply it to your forehead!
    TFA: apply it to your forehead!
    TFA: apply it to your forehead!

  13. Re:Just because the math works doesn't mean it's t on The End Of Gravity As a Fundamental Force · · Score: 1

    Do you realize that you are claiming understanding while responding to a /. echo of a piece on an alternative model of gravity, one that comes up with the same equations as general relativity, right?

  14. Re:you've read Hennessy/Patterson/Tannenwhatever on Intel and LG Team Up For x86 Smartphone · · Score: 1

    Can we multiply using a different result register than AX:DX (this one has always annoyed me)

    We've been able to do that since at least the 80386. In Intel/MASM syntax:

    imul ebx, ecx ; works just fine on 386, ebx = ebx * ecx

    What you can't do is get that double-wide answer without using EDX:EAX (or using more that one instruction, which is silly.) This isnt that big of an issue from a high level language point of view, since most of them wont give you a double-wide answer under any circumstances other than intrinsics/inline assembler. The flags are set correctly too (ex: overflow)

    There is even a 3 operand form:

    imul ebx, ecx, 1000 ; ebx = ecx * 1000, the last one has to be a constant.

    In all instances, the second operand can be a memory reference.

  15. Re:yes on Does a Lame E-Mail Address Really Matter? · · Score: 3, Informative

    Sometimes people look for new jobs while already employed, and some never stop looking.

  16. Re:I don't think it will cost you a job. on Does a Lame E-Mail Address Really Matter? · · Score: 1

    Use GMAIL as your main (personal) email address and your ISP's email as a throw-away catch-all for signing up to forums and the like (which will eventually sell your address to the highest bidders.)

  17. Re:yes on Does a Lame E-Mail Address Really Matter? · · Score: 4, Insightful

    You could look at this from the other direction too.

    Suppose the applicant is filtering employers by using an aol address, on the presumption that any MANAGER smart enough to avoid aol addresses is probably too smart to easily sabotage and then replace after getting hired.

  18. Re:So what's the new cool? on Does a Lame E-Mail Address Really Matter? · · Score: 1

    Its still me@godisdead.com

  19. Re:TOO MANY LINKS man! on Mozilla To Ditch Firefox Extensions? · · Score: 1

    So in other words they are getting ready to pull a Netscape 4 and shoot themselves right in the foot?

    I don't think they intend to take several years to rewrite the whole browser after this change, the result being a state that is less functional and more buggy than the current version, so no.... they arent pulling a Netscape 4 here.

  20. Re:Hotmail is Microsoft on Does a Lame E-Mail Address Really Matter? · · Score: 1

    Hotmail was not fine before Microsoft. Really. You must have been a big-time noob back then.

  21. Re:I gave up on viruses a long time ago on Malware Threat Reports Are "Apples and Oranges" · · Score: 1

    The people with the most computing power on the planet right now are Russian hackers (some of the botnets are estimated to total 4+ million machines)

    Supercomputers are yesterdays news. These botnets put them to shame on nearly every metric. The idea that you mentioned them as an important target in laughable, because even if hackers got in.. they would get noticed rather quickly even if nobody is watching for it when that 7 hour job instead takes 14.

    The key to the success of botnets is that very few ever do anything about it even when they know something is wrong. The masses are the target, not supercomputers.. this isnt the movie Hackers.. that ficticious gibson, even if it existed, wouldn't be worth an organized effort on the level that we see today.

  22. Re:Example of competition gone wrong on Malware Threat Reports Are "Apples and Oranges" · · Score: 1

    windows ships with several services on by default ... [snip] ... Linux/Mac ships with virtually nothing listening by default

    So they are the same then, right? You would have have not qualified "nothing" with "virtually" if you knew that you could get away with it (like if it was true) .. so we have you using liberal language on one side and conservative language on the other, to say the exact same thing. Why is that?

    Moving on:

    ... which cannot easily be turned off and are usually just hidden behind a software firewall... [snip] ... anything that is listening can be turned off and a software firewall (if you choose to enable one) provides an extra level of security on top of that

    Oh look, you did it again.

    Why are you so disingenuous?

    The fact of the matter is that it is Windows users who are the big problem and if 2010 was the year of Linux, you can damn welkl expect 2011 to be the year of big-time Linux malware.

  23. Re:Just because the math works doesn't mean it's t on The End Of Gravity As a Fundamental Force · · Score: 3, Insightful

    For instance the question of why there is inertia is addressed by the work of Higgs and the theoretical Higgs boson.

    No, it isnt addressed by it. This is just another theoretical model.

    In the case of gravity, begin with Newton.

    F = Gm'm"/d^2

    This is a model. This does not explain why there is gravity. The fact that we eventually found instances that contradict it lead to another model, general relativity. General relativity doesnt explain why there is gravity either, and we have since found cases where this model too many not hold ('dark energy'.) The Higgs wont dig us out of this lack of understanding, because nobody understands why things at these scales (see the photon) behave the way they do.

    120 years ago things were thought to be much simpler. Proton, Electron, and then Photon. That was it. Back then we could at least understand the models, but understanding the model is not the same as understanding reality (obviously, since we were wrong.) Now we have quantum theory and particles behaving like waves (or maybe its waves behaving like particles) culminating in the situation that nobody really even understands how reality could even be like the models.

    The model is all we have, and its not a description of reality, but instead a tool to predict observation.

    With a good enough model I can tell you where every pool ball on the table will end up. That model need not represent the reality that the pool balls are made up of trillions of atoms each made up of quarks and electrons, that the balls bounce against each other because the individual electrons repel each other while also binding atoms together, that the amount of kinetic energy (heat) in the balls will change, that even the shape of the balls changes as they move.

    The pro-pool player need not understand what is really going on to make the shot. His model, just like the model with individual atoms, is just a tool to make predictions. The little boy can ask "why" and the adult can answer, but that answer is not actually correct.

    Why do things in motion tend to stay in motion? Nobody knows! We call it Inertia.

  24. Re:TOO MANY LINKS man! on Mozilla To Ditch Firefox Extensions? · · Score: 1

    Well, not any JavaScript plugins anyways.

    It doesnt seem to me that they can kill the existing binary functionality without causing a fork that would be more popular, so the existing binary functionality will stay. Either way, having built-in User JavaScript functionality is a good thing, and for evidence of that see GreaseMonkey's popularity (essentially a 3rd party implementation of User JavaScript)

  25. Re:Just because the math works doesn't mean it's t on The End Of Gravity As a Fundamental Force · · Score: 3, Interesting

    There is a difference between assigning names to things and understanding them. While we have loads of empirical stuff to back up our theories, not a single one of those theories is grounded in actual understanding. This is true for string theory, for the theory of relativity, for quantum electrodynamics, and on and on.

    Even the simple things that you take for granted, such as Inertia, is not understood. Nobody can explain why there is Inertia, or what mechanisms makes it a requirement.

    What is important is that we can model things. If two such models fit observations, then there is no reason to dismiss one of them (such as string theory) out of hand. In the end, neither model is truth. Model's can't explain "why."