<commit_before>---
published: true
title: Benchmarking C++
tags: c++ fastware benchmarking lib
---
## [have a good baseline]({% post_url 2019-09-21-fastware-2015 %})

## Framework

- [facebook/folly](https://github.com/facebook/folly)
	- [benchmark](https://github.com/facebook/folly/blob/master/folly/docs/Benchmark.md)
	- doNotOptimizeAway() -  prevents compiler optimizations that may interfere with benchmarking 
{% highlight cpp %}
# not trivial to get dependancies rigth...
g++  example.cc -lfollybenchmark -lfolly -lglog -lgflags -pthread -lm -lpthread -ldl -ldouble-conversion -lboost_regex -lssl -lcrypto -liberty
{% endhighlight %}
    
    
- [google/benchmark](https://github.com/google/benchmark)
	- [tutorial](https://www.bfilipek.com/2016/05/google-benchmark-library.html)
<commit_msg>[perf c++]<commit_after>---
published: true
title: Benchmarking C++
tags: c++ fastware benchmarking lib
---
## [have a good baseline]({% post_url 2019-09-21-fastware-2015 %})

## Framework

- [facebook/folly](https://github.com/facebook/folly)
	- [benchmark](https://github.com/facebook/folly/blob/master/folly/docs/Benchmark.md)
	- doNotOptimizeAway() -  prevents compiler optimizations that may interfere with benchmarking 
{% highlight cpp %}
# not trivial to get dependancies rigth...
g++  example.cc -lfollybenchmark -lfolly -lglog -lgflags -pthread -lm -lpthread -ldl -ldouble-conversion -lboost_regex -lssl -lcrypto -liberty
{% endhighlight %}
    
    
- [google/benchmark](https://github.com/google/benchmark)
	- [tutorial](https://www.bfilipek.com/2016/05/google-benchmark-library.html)

## Unpexpected impact on performance

Adding unrelated function slow down/or accelerate code.

[Performance Analysis & Tuning on Modern CPU - <NAME>.](https://www.youtube.com/watch?v=Ho3bCIJcMcc&feature=youtu.be&t=351)
	- [Blog](https://easyperf.net/notes/)
    - [slides](https://github.com/dendibakh/dendibakh.github.io/blob/master/_posts/presentations/PerfAnalysisOnModernCPU.pdf)
{'fraction_non_alphanumeric': 0.1534578495709238, 'fraction_numerical': 0.020191822311963654, 'mean_word_length': 4.2994652406417115, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 11, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6589204', 'n_tokens_mistral': 734, 'n_tokens_neox': 665, 'n_words': 131}