boostorg / boostorg/date_time

time_duration inefficient compared to ptime and gregorian::date

Open
#105 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
70
Forks
99
PR merge metrics
No merged PRs in 30d

Description

compile this program:
```
#include
#include
#include
#include
#include

using namespace boost::posix_time;
using namespace boost::gregorian;
using namespace std;

int main(int argc, char *argv[])
{
const int64_t count = 1000000;

{
vector v;
v.reserve(count);
for (int64_t i=0; i(finish - start).count() << "s\n";
}

{
vector v;
v.reserve(count);
for (int64_t i=0; i(finish - start).count() << "s\n";
}

{
vector v;
v.reserve(count);
date d(1400,1,1);
for (int64_t i=0; i(finish - start).count() << "s\n";
}

{
vector v;
v.reserve(count);
ptime p(date(1400,1,1));
for (int64_t i=0; i(finish - start).count() << "s\n";
}

return 0;
}
```

program output on my machine:

time_duration sort: 3.60364s
int64_t sort: 0.560309s
date sort: 0.610657s
ptime sort: 1.36204s

the question is, what is so special about time_duration making it so unbelievably inefficient? it is even more inefficient than ptime!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.