diff options
| author | Aiden Woodruff <woodra@rpi.edu> | 2025-11-28 21:46:40 -0500 |
|---|---|---|
| committer | Aiden Woodruff <woodra@rpi.edu> | 2025-11-28 21:46:40 -0500 |
| commit | 80ca2b9a2499b4353685055dbf8bd49ca7521803 (patch) | |
| tree | 118d3333b49b184a21ef638168dd74becc7be57a /src | |
| parent | 3db9a0590d9dc912e71283dbcceec8be5c1efb94 (diff) | |
| download | tipping-points-80ca2b9a2499b4353685055dbf8bd49ca7521803.tar.gz tipping-points-80ca2b9a2499b4353685055dbf8bd49ca7521803.tar.bz2 tipping-points-80ca2b9a2499b4353685055dbf8bd49ca7521803.zip | |
improve NameGame.cc
- src/NameGame.cc: explicit instantiation of copy assignment operator to
avoid over-optimization removing the function.
- (update_memory): use TVec DelLast instead of Trunc which calls
realloc. This is a little bit faster but still doesn't beat TLst.
Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
Diffstat (limited to 'src')
| -rw-r--r-- | src/NameGame.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/NameGame.cc b/src/NameGame.cc index ed56f09..bfd681c 100644 --- a/src/NameGame.cc +++ b/src/NameGame.cc | |||
| @@ -56,6 +56,8 @@ TLst<TVal>& TLst<TVal>::operator=(const TLst<TVal>& l) { | |||
| 56 | } | 56 | } |
| 57 | return *this; | 57 | return *this; |
| 58 | } | 58 | } |
| 59 | |||
| 60 | template TLst<TInt>& TLst<TInt>::operator=(const TLst<TInt>& l); | ||
| 59 | #else | 61 | #else |
| 60 | template<typename TVal, typename TSizeTy> | 62 | template<typename TVal, typename TSizeTy> |
| 61 | auto begin(const TVec<TVal, TSizeTy>& v) -> decltype(v.BegI()) { | 63 | auto begin(const TVec<TVal, TSizeTy>& v) -> decltype(v.BegI()) { |
| @@ -234,7 +236,7 @@ void NameGame::update_memory(int nId, int strategy) { | |||
| 234 | d.Val2.DelLast(); | 236 | d.Val2.DelLast(); |
| 235 | #else | 237 | #else |
| 236 | d.Val2.Ins(0, strategy); | 238 | d.Val2.Ins(0, strategy); |
| 237 | d.Val2.Trunc(memlen); | 239 | d.Val2.DelLast(); |
| 238 | #endif | 240 | #endif |
| 239 | } | 241 | } |
| 240 | } | 242 | } |
