Tag: assembly

58 votes
11 answers
1.9K views
Why does C++ code for testing the Collatz conjecture run faster than hand-written assembly?

I wrote these two solutions for Project Euler Q14, in assembly and in C++. They implement identical brute forc

avatar
Deedee
0 1 0 9
asked 07 September, 2021
64 votes
11 answers
1.9K views
Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviations with _mm_popcnt_u64 on Intel CPUs

I was looking for the fastest way to popcount large arrays of data. I encountered a very weird effect: Changin

avatar
Daniel
0 1 0 9
asked 07 September, 2021
62 votes
14 answers
659 views
Is < faster than <=?

Is if (a < 901) faster than if (a <= 900)? Not exactly as in this simple example, but there are slight p

avatar
Trudy
0 1 0 9
asked 07 September, 2021
58 votes
12 answers
931 views
Why doesn&apos;t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?

I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optim

avatar
Venice
0 1 0 9
asked 07 September, 2021
67 votes
7 answers
834 views
What is the purpose of a stack? Why do we need it?

So I am learning MSIL right now to learn to debug my C# .NET applications. I've always wondered: what is

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
57 votes
1 answers
2K views
fast multiplication of int8 arrays by constants

I wonder if there is a fast way of multiplying int8 arrays, i.e. for(i = 0; i < n; ++i) z[i] = x * y[i]

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
67 votes
6 answers
557 views
How can one generate and save a file client side using Blazor?

I want to have a SPA that's doing all the work client side and even generating some graphs/visuals. I&ap

avatar
Boyd
0 1 0 9
asked 07 September, 2021