Surprisingly on Apple M2 (ARM) atomic is inferior to mutex.
g++ -std=c++20 -O3 atomic_vs_mutex_cnt.cpp -pthread
python3 run_counter.py > counter_perf.csv
pip3 install pandas seaborn
python3 plot.pysee result in mutex_vs_atomic_m2_chart.png
Surprisingly on Apple M2 (ARM) atomic is inferior to mutex.
g++ -std=c++20 -O3 atomic_vs_mutex_cnt.cpp -pthread
python3 run_counter.py > counter_perf.csv
pip3 install pandas seaborn
python3 plot.pysee result in mutex_vs_atomic_m2_chart.png
| class Color: | |
| """ | |
| https://misc.flogisoft.com/bash/tip_colors_and_formatting | |
| https://gist.github.com/dmitryhd/68f2a71fb2832643217c17e61a78b214 | |
| """ | |
| COLOR = '\033[' | |
| BOLD = '\033[1m' | |
| RESET = '\033[0m' | |
| DIM = '\e[2m' | |
| BLINK = '\e[5m' |
| from line_profiler import LineProfiler | |
| def profile_function(func, *args, **kwargs): | |
| ''' | |
| Usage: | |
| def long_function(x, y) | |
| return x + y | |
| z = profile_function(long_function, x=1, y=2) |
| __all__ = [ | |
| 'SlackBot', | |
| 'RecBot', | |
| ] | |
| import os | |
| import time | |
| import re | |
| import subprocess | |
| from functools import wraps |
| import matplotlib.pyplot as plt | |
| import matplotlib | |
| import seaborn as sns | |
| %matplotlib inline | |
| plt.rcParams["figure.figsize"] = (12., 7.) | |
| %config InlineBackend.figure_format = 'retina' | |
| sns.set_style('dark') | |
| matplotlib.rc('font', family='Arial') # in case of missing cyrillic fonts | |
| import warnings; warnings.filterwarnings("ignore") # font warning |
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| import re | |
| import sys | |
| def c(i): | |
| """ |
| import logging | |
| import logging.handlers | |
| import os.path as path | |
| LOG_FORMAT = '[%(asctime)s] %(levelname)s %(message)s' | |
| TIME_FORMAT = '%Y-%m-%d %H:%M:%S' | |
| LOG_DEFAULT_LEVEL = logging.DEBUG | |
| import matplotlib.pyplot as plt | |
| import matplotlib.pylab as pylab | |
| import seaborn as sns | |
| %matplotlib inline | |
| pylab.rcParams['figure.figsize'] = 12.0, 7.0 | |
| plt.rcParams['axes.labelweight'] = 'bold' | |
| plt.rcParams['axes.titleweight'] = 'bold' | |
| plt.rcParams['font.family'] = 'serif' |
| import logging | |
| import logging.handlers | |
| import os.path as path | |
| def configure_logger( | |
| logger_name='logger', | |
| log_dir='/tmp/', | |
| filename='', | |
| to_stdout=True, |