|
Slap -S on there and see what the compiler is doing to your code.
|
# ¿ Feb 28, 2012 17:26 |
|
|
# ¿ May 15, 2024 09:21 |
|
Zhentar posted:(and be using registers pretty much exclusively anyway). Nah, at -O0 gcc operates entirely on the stack . In that pastebin foo uses [rbp-20] as i, bar uses [rbp-4]. The actual for loops are compiled to be basically identical, but bar has the overhead of control flow. Master_Odin, if you're interested, bar is executing 2 jumps before it calls foo. You check if the argument i is 0 (cmpl $0, -20(%rbp)), then you check if it's 1 (cmpl $1, -20(%rbp)), then finally store the argument to foo and jump. When i=0, you've still got an extra branch checking for that condition before executing the for loop. I don't understand the profiler output you posted earlier (never used gprof) but you're calling bar twice. On the first time, it figures out the control flow and calls foo, so 'bar' looks like it takes 'foo+overhead' time. Then you call bar again and the very first jump goes a different direction1, then you hit the for loop. So bar has a little extra overhead both times you call it. I'm not sure if that entirely explains the discrepancy, but it doesn't surprise me that bar would take measurably longer to run the 'same' code. Control flow isn't free 1I'm really hesitant to bring up branch prediction, especially in a context like this. Early on in my career, another engineer brought me a snippet of code and said it mispredicted 5 times. I was quick to explain, "Oh of course you'd expect 5, the first one is branch y that goes forward..." and had a neat lil story about how it happened. Another engineer overheard, and came to correct me with their neat lil story about how it happened. Long story short, 3 people well-versed in the microarchitecture were all entirely wrong about how branches were predicted, even when the total count was given in advance. So I don't have much faith in coders predicting predictors a priori.
|
# ¿ Feb 29, 2012 01:16 |
|
Contero posted:The circuit will never become stable the way I'm simulating it. Then you have a hardware loop or the oscillation is by design? I can't tell from your description which case you're worried about, you should read up on System Verilog Scheduling Semantics. You need more words that "current/next".
|
# ¿ Mar 8, 2012 16:27 |
|
Check out the Girvan-Newman algorithm. Doesn't help you with the "how many clusters" problem Lysidas mentioned, but it'll give you the clusters.
|
# ¿ Mar 27, 2012 16:09 |
|
Sedro posted:Because that will only match the beginning of the string (only the first line) and AFAIK there is no "beginning of line" anchor. What goofy regex environment are you in that isn't splitting up lines for you? "undef $\"?
|
# ¿ Mar 30, 2012 23:39 |
|
Bob Morales posted:I find if you don't have a pet project in mind you'll just wander around aimlessly. This bit is far more important than what language you choose. If you're just doing toy problems without an end goal, you'd have to have superhuman motivation to chug through. If you're solving a problem for yourself, it's much easier to see it through.
|
# ¿ Apr 3, 2012 16:50 |
|
Sab669 posted:I'm starting my senior project and we'll be doing it in PHP Senior in high school, right??
|
# ¿ Apr 4, 2012 21:34 |
|
Sab669 posted:Um, how many actual languages did you learn in college? Sure, okay, I have SQL in there as well of course but I'm not going to list every single course I've taken that introduced me to something new such as Javascript. You're graduating college and you don't know what a pointer is?? There are entire classes of CS problems you don't even have the vocabulary to discuss. Since you're curious, I wrote programs in C/C++, Java, Lisp, Verilog, and MIPS asm.
|
# ¿ Apr 4, 2012 22:46 |
|
Phiberoptik posted:Right now Ive gotten it to the point where Itll tell me my two cards, so say "Ac" in one variable, and "Ad" in another variable. I'm wondering what the best way it is to compare to a list of hands Id like to fold. You probably want to write some helper functions that pull out information about the cards. I'm thinking in an OO way, but something like card.suit() that would return the suit and card.value() that would return the numeric value. Then you'd build rules based on that, like code:
|
# ¿ May 30, 2012 22:35 |
|
peepsalot posted:e: what's with all the linux questions unrelated to programming lately. There's a general linux question thread. School's out for summer, "Programming" is the next visible abstraction for "kid who's good w/ computers"
|
# ¿ Jun 4, 2012 18:46 |
|
tef posted:Beware of the side-effects of learning lisp. It makes you a smug rear end in a top hat. I thought functional languages didn't have those?
|
# ¿ Jun 12, 2012 18:13 |
|
It's going to vary wildly between different processor families. Even within a family different types of branch mispredicts can have different costs, e.g. if the CPU predicts based on IP address then corrects after decode, or if a prediction made at decode actually takes until the backend computes some result that changes the branch path. If you've got a very specific system in mind, you could probably do some basic analysis on your own with PMONs, check the PRM vol. 3B. Realistically on any sane code you're getting 95% or better and branch mispredicts aren't eating up a lot of your time anyway. If you want a cite for the basic bimodal predictor just use the Yeh-Patt paper.
|
# ¿ Jul 9, 2012 23:29 |
|
Dijkstracula posted:My understanding of what would happen is that, say, a branch marked strongly-taken will start executing both branches I'm only aware of one architecture that tried to do things this way (Sun's Rock). Remember that our predictors are well above 95% in most cases, why would you waste pipeline space on ops that you think have a 3% chance of actually mattering? You charge ahead on the probable path, knowing you'll have to clear the whole pipeline if you're wrong. It really sounds like PMONs and TSC readings could get you exact data on what you need. You're having far too much fun anyway, curl up around a computer. Although chasing down every cite of Yeh-Patt probably has you doing that anyway.
|
# ¿ Jul 9, 2012 23:53 |
|
code:
|
# ¿ Aug 24, 2012 00:04 |
|
Oh, you mean the documented behavior of the Bing toolbar that the Google engineers agreed to when they installed it before doing that test? JawnV6 fucked around with this message at 23:52 on Aug 24, 2012 |
# ¿ Aug 24, 2012 22:35 |
|
Suspicious Dish posted:Chrome does not do any user tracking. It's a myth that has been dispelled by multiple Google engineers. If you have a better citation than Google engineers, please let me know. It was Google Toolbar, not Chrome. My bad. The relevant question still stands, and Google Engineers were "mystified" when the Bing toolbar sent a clickstream, exactly as it said it would when they agreed to install it.
|
# ¿ Aug 24, 2012 23:56 |
|
Delete the directory.
|
# ¿ Sep 14, 2012 15:05 |
|
Sab669 posted:I really can't find anything interesting that's legitimately new Such a Thing doesn't exist.
|
# ¿ Sep 18, 2012 21:23 |
|
Sylink posted:This is because I imagine trying to calculate the time billions of times a second will add in all kinds of crazy errors. What kind of crazy errors are you imagining?
|
# ¿ Oct 30, 2012 18:08 |
|
Dear god please use the syscalls
|
# ¿ Oct 30, 2012 18:42 |
|
shrughes posted:Using the rdtsc instruction to get the time in "cycles" will take about 20 ns.
|
# ¿ Oct 30, 2012 22:56 |
|
shrughes posted:It's not a miniscule hit and rdtsc has had no practical problems for measuring timings for us JawnV6 posted:Depending on your processor you also get to learn all about C states and P states and after tearing your hair out for a while finally understand why you should probably just chuck it to the OS for the minuscule hit.
|
# ¿ Oct 31, 2012 15:51 |
|
yaoi prophet posted:Why are we talking about this anyway? We don't even know how accurate Sylink needs the count to be. He said "billions of times a second." That puts you on the ns scale. JawnV6 fucked around with this message at 16:54 on Nov 1, 2012 |
# ¿ Nov 1, 2012 08:03 |
|
yaoi prophet posted:I think he was assuming that if they didn't put in a timer and just ran everything as fast as possible they'd run it billions of times a second (which they obviously won't unless they have some kind of terahertz processor). Do programmers really lack this kind of intuition? What the heck do they think a gigahertz is? Or is the confusion on IPC? The units are right there in the question. On the last page you clearly have the kind of intuition I'm talking about and know that billions/sec implies a limit of a few instructions. I guess I thought that was more common.
|
# ¿ Nov 1, 2012 22:03 |
|
yaoi prophet posted:How does memory virtualization work with Intel VMX? My understanding is that with EPT the guest can do whatever it wants with CR3, and then the EPT steps in and translates the guest-physical address to a host physical, but what do you do if you don't have EPT available? Trap it and do it in software. There's a VMware whitepaper that compares shadow page tables to EPT.
|
# ¿ Nov 13, 2012 07:21 |
|
Yeah, that makes sense. Are you freezing the code or is RAM being updated while you dump? If you get clean snapshots without any skid, the analysis should be relatively simple. If the value in address 0x1000 is consistently 3x the value you're looking for across a dozen traces, it's probably linked that way in the code.
|
# ¿ Jan 11, 2013 01:15 |
|
I was trying to figure out what kind of variability you were accounting for with the statistical analysis. e.g. it might be possible to sample the known location and see 10 and sample the unknown location when the variable's been updated to 100. It doesn't sound like your system is susceptible to that failure mode. Seems you're more worried about analog sensing and scaling where the unknown value reads out as 3.99x, 4.01x, 4.02x and you want to tease out that it's ~4?
|
# ¿ Jan 11, 2013 01:47 |
|
uh hopping ISA's is so much bigger than 32/64 i'm not sure why the latter merits discussion
|
# ¿ Feb 21, 2013 17:51 |
|
Jabor posted:Just knowing that everyone running {windows released in the past X years} is capable of running a 64-bit app Care to take a stab at the low end of X? As in after what year could we maybe possibly begin to say that?
|
# ¿ Feb 22, 2013 00:45 |
|
How was there not a prereq to have some programming before this course? I'll type more later but wtf
|
# ¿ Feb 28, 2013 01:01 |
|
Xerophyte posted:Sheesh. In spite of what a lot of people here apparently think there's no rule saying your brain will explode unless you start at an abstract language and work your way down to the metal, especially if you're in EE. As an aside, have you ever worked with someone who learned from assembly? In my perl class there was a guy who'd only written x86 asm for 20 years. I think he choked back tears when he understood the complexity being swept up behind "if" statements. Just imagine "programming languages teach you to not want what they don't provide" taken to the extreme. Sirocco posted:Technically we only learned how to make files and scan them for viruses last semester, ha ha. I don't know what kind of program we're supposed to be writing, there's no reference to it in the notes. All the lecturer said was that it should be "fairly complex" which is pretty nebulous but I expect the program writing will be a few months down the line.
|
# ¿ Feb 28, 2013 16:18 |
|
Xerophyte posted:You might as well say that higher level programming languages are an API between humans and assembly and coming at them from just one side will be confusing. Which it is, but you have to start somewhere and for an electrical engineer building a CPU from the ground up and then introducing assembly mnemonics as a way to interface with it is probably among the more intuitive options. Xerophyte posted:Sure, he'd be writing better assembly if he'd learnt a higher level language first. He's also going to write better high level code from learning assembly first when he starts with that. Going HLL->asm is a way to bypass compilers in understanding computing by jumping down to that abstraction. Programmers get to see the atomic operations that all their HLL statements must be broken down into Going asm->HLL gives you nothing. You're better off ignoring the asm learnings entirely until you're on solid footing with the HLL abstraction. Bunny Cuddlin posted:This is ridiculous. Learning assembly on the heels of learning hardware organization is a completely natural progression, it's nothing like trying to teach OOP before teaching basic programming skills.
|
# ¿ Feb 28, 2013 18:56 |
|
Bunny Cuddlin posted:If I wanted to write a toy operating system for a toy architecture, is Modern Operating Systems the book to buy? My course used Operating System Concepts, which was just fine. What toy architecture?
|
# ¿ Mar 13, 2013 17:52 |
|
I'm not really sure if they went into your specific questions, but the Hydan paper was geared to hide information in x86 binaries and might cover some shared ground. I have a perl script. I want to distribute similar code to non-CS folks. Are C# regex/data structures the easiest path to translate perl into for easy distribution? e: done a couple hours later without burning hard on it, so "yes" JawnV6 fucked around with this message at 23:09 on Apr 19, 2013 |
# ¿ Apr 19, 2013 21:14 |
|
Yeah once you've built a foundry and then a lathe with it, a fun lil' project is to put together a mill!
|
# ¿ May 17, 2013 21:29 |
|
Dicks can be quite persuasive.
|
# ¿ May 20, 2013 17:04 |
|
Sab669 posted:That seems like a poor idea, unless figure 1A is "lovely code you will write" and then 1B is "good code you might write after 5+ years" Given that it's a book about compilers, source code maintainability may not have been their primary concern.
|
# ¿ May 22, 2013 16:20 |
|
Syle187 posted:Should I just grab a book on VB6? Apply directly to forehead.
|
# ¿ May 31, 2013 22:31 |
|
Seems like Eugenics is trying to come up with a single regex that will capture data from multiple lines up until the next >>log? What language are you working in? You probably want something like this skeleton (perl): Perl code:
|
# ¿ Jun 10, 2013 17:29 |
|
|
# ¿ May 15, 2024 09:21 |
|
Hard NOP Life posted:Just to nitpick but your factorial function isn't checking for a negative input. Pseudo-God posted:It's sufficient to explain the concept. There are many things the input does not check, such as whether it's a floating point, a string, or totally something else.
|
# ¿ Jun 20, 2013 23:41 |