Linked Questions

2 votes
0 answers
370 views

I have tried writing my first assembly program (NASM x86 assembly). It is an linear congruential generator, or the plan was that is is one. Because of limitations of my assembly skills I had to change ...
The Kraken's user avatar
0 votes
0 answers
214 views

I'm trying to optimize the runtime of the code that I wrote for computing the number of iterations it takes to reach 1 in the collatz conjecture Here is my psudeocode for this int threexplusone(int x){...
Hongyan Wu's user avatar
644 votes
34 answers
95k views

There are plenty of performance questions on this site already, but it occurs to me that almost all are very problem-specific and fairly narrow. And almost all repeat the advice to avoid premature ...
1656 votes
11 answers
202k views

I was looking for the fastest way to popcount large arrays of data. I encountered a very weird effect: Changing the loop variable from unsigned to uint64_t made the performance drop by 50% on my PC. ...
gexicide's user avatar
  • 40.4k
763 votes
24 answers
1.4m views

I'm looking for detailed information regarding the size of basic C++ types. I know that it depends on the architecture (16 bits, 32 bits, 64 bits) and the compiler. But are there any standards for C++?...
Jérôme's user avatar
  • 27.2k
502 votes
40 answers
154k views

One of the stated reasons for knowing assembler is that, on occasion, it can be employed to write code that will be more performant than writing that code in a higher-level language, C in particular. ...
546 votes
17 answers
569k views

How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted assembly code?
Doug T.'s user avatar
  • 65.9k
207 votes
21 answers
75k views

I tried to compare the performance of inline assembly language and C++ code, so I wrote a function that add two arrays of size 2000 for 100000 times. Here's the code: #define TIMES 100000 void calcuC(...
user957121's user avatar
  • 3,074
89 votes
30 answers
67k views

I have a question for all the hardcore low level hackers out there. I ran across this sentence in a blog. I don't really think the source matters (it's Haack if you really care) because it seems to ...
Tom Ritter's user avatar
  • 102k
350 votes
4 answers
51k views

I've been racking my brain for a week trying to complete this assignment and I'm hoping someone here can lead me toward the right path. Let me start with the instructor's instructions: Your ...
Cowmoogun's user avatar
  • 2,577
278 votes
5 answers
43k views

I've been reading about div and mul assembly operations, and I decided to see them in action by writing a simple program in C: File division.c #include <stdlib.h> #include <stdio.h> int ...
qiubit's user avatar
  • 4,846
192 votes
1 answer
95k views

All the following instructions do the same thing: set %eax to zero. Which way is optimal (requiring fewest machine cycles)? xorl %eax, %eax mov $0, %eax andl $0, %eax
balajimc55's user avatar
  • 2,305
86 votes
9 answers
8k views

I don't want to optimize anything, I swear, I just want to ask this question out of curiosity. I know that on most hardware there's an assembly command of bit-shift (e.g. shl, shr), which is a single ...
Armen Tsirunyan's user avatar
79 votes
6 answers
9k views

I'm currently working on a project and I have the following issue. I have a C++ method that I want to work in two different ways : void MyFunction() { foo(); bar(); foobar(); } void ...
plougue's user avatar
  • 571
121 votes
3 answers
38k views

I want to inspect the assembly output of applying boost::variant in my code in order to see which intermediate calls are optimized away. When I compile the following example (with GCC 5.3 using g++ -...
m.s.'s user avatar
  • 16.4k

15 30 50 per page
1
2 3 4 5
8