From 6f69f044495aac0f04e4ee89ea661865ef1cd536 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 21 Apr 2018 16:18:44 +0200 Subject: [PATCH] improved the memoization of cell distances --- cell.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cell.cpp b/cell.cpp index 4f74783e..b7794ea7 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1379,12 +1379,15 @@ int celldistance(cell *c1, cell *c2) { return eudist(decodeId(c1->master) - decodeId(c2->master)); } - if(sphere || quotient == 1 || gp::on) { + if(quotient == 2 && !gp::on) + return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2)); + + if(sphere || quotient) { if(saved_distances.count(make_pair(c1,c2))) return saved_distances[make_pair(c1,c2)]; - celllister cl(c1, 64, 1000, c2); + celllister cl(c1, 100, 100000000, NULL); for(int i=0; i