Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f40a261

Browse files
Added METL Parser
Added msvc2017/msvc2015 solutions Using std::chrono for timing Various updates to benchmark suite Updated readme
1 parent 588e4df commit f40a261

File tree

169 files changed

+13938
-1620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+13938
-1620
lines changed

‎bench_expr_complete.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6614,4 +6614,4 @@ cos(tan(tan(tan((((e-(sin((tan((((sin((3.77+((b*((((0.52/((((cos((((((((sin(cos(
66146614
((((((((x*y)/7.123)-w)/((x-y)-(7.123*w)))/(((x-y)+(7.123/w))-((x+y)*(7.123*w))))/((((x-y)-(7.123*w))*((x+y)*(7.123/w)))*(((x+y)*(7.123*w))+(x-(y/(7.123*w))))))/(((((x+y)-(7.321*w))+((x/y)+(7.321+w)))+(((x*y)+(7.321+w))*((x/y)/(7.321-w))))+((((x/y)+(7.321+w))/((x*y)*(7.321-w)))/(((x/y)/(7.321-w))-(x-((y-7.321)*w)))))))
66156615
((((((((x*y)*7.123)-w)/((x+y)+(7.123*w)))/(((x+y)-(7.123/w))-((x*y)+(7.123-w))))/((((x+y)+(7.123*w))*((x/y)+(7.123-w)))*(((x*y)+(7.123-w))+((x/y)*(7.123-w)))))/((((x/(y+(7.321*w)))+((x-y)/(7.321+w)))+(((x-y)*(7.321+w))*((x/y)*(7.321+w))))+((((x-y)/(7.321+w))/((x*y)/(7.321+w)))/(((x/y)*(7.321+w))-(x+((y/7.321)*w)))))))
66166616
((((((((x+y)/7.123)-w)-((x-y)+(7.123*w)))-(((x+y)+(7.123/w))/((x*y)-(7.123-w))))-((((x-y)+(7.123*w))+((x/y)-(7.123-w)))+(((x*y)-(7.123-w))*(x-(y*(7.123/w))))))-((((x*(y+(7.321*w)))*((x/y)-(7.321+w)))*(((x*y)-(7.321+w))+((x/y)/(7.321+w))))*((((x/y)-(7.321+w))-((x*y)/(7.321-w)))-(((x/y)/(7.321+w))/(x-((y+7.321)*w)))))))
6617-
((((((((x+y)*7.123)-w)-((x+y)-(7.123*w)))-((x*(y-(7.123*w)))/((x*y)+(7.123+w))))-((((x+y)-(7.123*w))+((x/y)+(7.123+w)))+(((x*y)+(7.123+w))*((x/y)/(7.123-w)))))-(((((x/y)-(7.321/w))*((x-y)+(7.321+w)))*(((x-y)-(7.321+w))+((x-y)*(7.321/w))))*((((x-y)+(7.321+w))-((x*y)*(7.321+w)))-(((x-y)*(7.321/w))/(x+((y/7.321)+w)))))))
6617+
((((((((x+y)*7.123)-w)-((x+y)-(7.123*w)))-((x*(y-(7.123*w)))/((x*y)+(7.123+w))))-((((x+y)-(7.123*w))+((x/y)+(7.123+w)))+(((x*y)+(7.123+w))*((x/y)/(7.123-w)))))-(((((x/y)-(7.321/w))*((x-y)+(7.321+w)))*(((x-y)-(7.321+w))+((x-y)*(7.321/w))))*((((x-y)+(7.321+w))-((x*y)*(7.321+w)))-(((x-y)*(7.321/w))/(x+((y/7.321)+w)))))))

‎include/BenchMETL.h‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef BENCH_METL_H
2+
#define BENCH_METL_H
3+
4+
#if defined(_MSC_VER) && (_MSC_VER >= 1913)
5+
// Should be: #if __cplusplus > 201103L
6+
7+
#include <vector>
8+
#include <string>
9+
10+
#include "Benchmark.h"
11+
12+
//-------------------------------------------------------------------------------------------------
13+
#define ENABLE_METL
14+
15+
class BenchMETL : public Benchmark
16+
{
17+
public:
18+
19+
BenchMETL();
20+
21+
double DoBenchmark(const std::string& sExpr, long iCount);
22+
};
23+
#endif
24+
25+
#endif

‎include/Benchmark.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class Benchmark
2828
Benchmark(EBaseType eBaseType = DOUBLE);
2929
virtual ~Benchmark();
3030

31-
void DoAll(std::vector<std::string> vExpr, long num);
32-
3331
virtual double DoBenchmark(const std::string& sExpr, long iCount) = 0;
3432
virtual void PreprocessExpr(std::vector<std::string>& vExpr);
3533
virtual void PreprocessExpr(std::string& /*vExpr*/) {};

‎include/Stopwatch.h‎

Lines changed: 13 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,113 +3,47 @@
33

44
#include <limits>
55
#include <ctime>
6-
7-
#ifdef WIN32
8-
# ifndef NOMINMAX
9-
# define NOMINMAX
10-
# endif
11-
# ifndef WIN32_LEAN_AND_MEAN
12-
# define WIN32_LEAN_AND_MEAN
13-
# endif
14-
# include <windows.h>
15-
#else
16-
# include <sys/time.h>
17-
# include <sys/types.h>
18-
#endif
6+
#include <chrono>
197

208
class Stopwatch
219
{
2210
public:
2311

24-
#ifdef WIN32
2512
Stopwatch()
2613
: in_use_(false)
27-
{
28-
QueryPerformanceFrequency(&clock_frequency_);
29-
}
14+
{}
3015

3116
inline void Start()
3217
{
3318
in_use_ = true;
34-
QueryPerformanceCounter(&start_time_);
19+
start_time_ = std::chrono::steady_clock::now();
3520
}
3621

3722
inline double Stop()
3823
{
39-
QueryPerformanceCounter(&stop_time_);
24+
stop_time_ = std::chrono::steady_clock::now();
4025
in_use_ = false;
41-
return (time() * 1000.0);
42-
}
43-
44-
inline double time() const
45-
{
46-
return (1.0 * (stop_time_.QuadPart - start_time_.QuadPart)) / (1.0 * clock_frequency_.QuadPart);
47-
}
48-
49-
#else
50-
51-
Stopwatch()
52-
: in_use_(false)
53-
{
54-
start_time_.tv_sec = 0;
55-
start_time_.tv_usec = 0;
56-
stop_time_.tv_sec = 0;
57-
stop_time_.tv_usec = 0;
58-
}
59-
60-
inline void Start()
61-
{
62-
in_use_ = true;
63-
gettimeofday(&start_time_,0);
26+
return time();
6427
}
6528

66-
inline doubleStop()
29+
inline boolin_use() const
6730
{
68-
gettimeofday(&stop_time_, 0);
69-
in_use_ = false;
70-
return (time() * 1000.0);
31+
return in_use_;
7132
}
7233

73-
inline unsigned long long int usec_time() const
74-
{
75-
if (!in_use_)
76-
{
77-
if (stop_time_.tv_sec >= start_time_.tv_sec)
78-
{
79-
return 1000000 * (stop_time_.tv_sec - start_time_.tv_sec ) +
80-
(stop_time_.tv_usec - start_time_.tv_usec);
81-
}
82-
else
83-
return std::numeric_limits<unsigned long long int>::max();
84-
}
85-
else
86-
return std::numeric_limits<unsigned long long int>::max();
87-
}
34+
private:
8835

8936
inline double time() const
9037
{
91-
return usec_time() * 0.000001;
92-
}
93-
94-
#endif
95-
96-
inline bool in_use() const
97-
{
98-
return in_use_;
38+
const auto duration = stop_time_ - start_time_;
39+
return std::chrono::duration<double,std::nano>(duration).count();
9940
}
10041

101-
private:
42+
typedef std::chrono::time_point<std::chrono::steady_clock> time_point_t;
10243

44+
time_point_t start_time_;
45+
time_point_t stop_time_;
10346
bool in_use_;
104-
105-
#ifdef WIN32
106-
LARGE_INTEGER start_time_;
107-
LARGE_INTEGER stop_time_;
108-
LARGE_INTEGER clock_frequency_;
109-
#else
110-
struct timeval start_time_;
111-
struct timeval stop_time_;
112-
#endif
11347
};
11448

11549
#endif

‎logs/shootout_20180421_00.zip‎

2.35 MB
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /