Hobo Chen

Play with Fun Assumptions

I found it frustrated when I found some of my basic assumptions not true.
And I realized that, whatever I am doing, I always assumes something in pervious.
So I use this page to note some interesting assumptions made by me or I met, regardless they are proved true or false finally.

Programming

quick-sort Is Always the Fastest Sorting Algorithms

false, when the array is not that long, inserting sort is much faster.

Atomic Operations of Integral Types (such as int64) Are lock-free

false, it depends on the hardware.

Doc: GCC: Built-in Functions for Memory Model Aware Atomic Operations

You can check via compiling and run the following codes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <bits/stdc++.h>

using namespace std;

template <int l>
void f() {
cout << l << " bytes: " << __atomic_always_lock_free(l, 0) << endl;
f<l / 2>();
}

template <>
void f<1>() {
cout << 1 << " bytes: " << __atomic_always_lock_free(1, 0) << endl;
}

int main() {
f<256>();
}

History