Skip to content

Commit 21a222f

Browse files
chore: update minified library versions
1 parent ec88e33 commit 21a222f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cp-algo/min/util/big_alloc.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef CP_ALGO_UTIL_big_alloc_HPP
22
#define CP_ALGO_UTIL_big_alloc_HPP
3+
#include <deque>
34
#include <vector>
5+
#include <string>
46
#include <cstddef>
57
#include <iostream>
68
#if defined(__linux__) || defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
@@ -17,5 +19,5 @@ return static_cast<T*>(::operator new(padded,std::align_val_t(align)));}void dea
1719
#if CP_ALGO_USE_MMAP
1820
if(padded>=MEGABYTE){munmap(p,padded);return;}
1921
#endif
20-
::operator delete(p,padded,std::align_val_t(align));}private:static constexpr std::size_t MEGABYTE=1<<20;static constexpr std::size_t round_up(std::size_t x)noexcept{return(x+Align-1)/Align*Align;}};template<typename T>using big_vector=std::vector<T,big_alloc<T>>;template<typename T>using big_basic_string=std::basic_string<T,std::char_traits<T>,big_alloc<T>>;using big_string=big_basic_string<char>;}
22+
::operator delete(p,padded,std::align_val_t(align));}private:static constexpr std::size_t MEGABYTE=1<<20;static constexpr std::size_t round_up(std::size_t x)noexcept{return(x+Align-1)/Align*Align;}};template<typename T>using big_vector=std::vector<T,big_alloc<T>>;template<typename T>using big_basic_string=std::basic_string<T,std::char_traits<T>,big_alloc<T>>;template<typename T>using big_deque=std::deque<T,big_alloc<T>>;using big_string=big_basic_string<char>;}
2123
#endif

cp-algo/min/util/checkpoint.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#ifndef CP_ALGO_UTIL_CHECKPOINT_HPP
22
#define CP_ALGO_UTIL_CHECKPOINT_HPP
3+
#include "../util/big_alloc.hpp"
34
#include <iostream>
45
#include <chrono>
56
#include <string>
67
#include <map>
78
namespace cp_algo{
89
#ifdef CP_ALGO_CHECKPOINT
9-
std::map<std::string,double>checkpoints;double last;
10+
std::map<big_string,double>checkpoints;double last;
1011
#endif
1112
template<bool final=false>void checkpoint([[maybe_unused]]auto const&_msg){
1213
#ifdef CP_ALGO_CHECKPOINT
13-
std::string msg=_msg;double now=(double)clock()/CLOCKS_PER_SEC;double delta=now-last;last=now;if(msg.size()&&!final){checkpoints[msg]+=delta;}if(final){for(auto const&[key,value]:checkpoints){std::cerr<<key<<": "<<value*1000<<" ms\n";}std::cerr<<"Total: "<<now*1000<<" ms\n";}
14+
big_string msg=_msg;double now=(double)clock()/CLOCKS_PER_SEC;double delta=now-last;last=now;if(msg.size()&&!final){checkpoints[msg]+=delta;}if(final){for(auto const&[key,value]:checkpoints){std::cerr<<key<<": "<<value*1000<<" ms\n";}std::cerr<<"Total: "<<now*1000<<" ms\n";}
1415
#endif
1516
}template<bool final=false>void checkpoint(){checkpoint<final>("");}}
1617
#endif

0 commit comments

Comments
 (0)