diff -up src/fpylll/algorithms/bkz.py.orig src/fpylll/algorithms/bkz.py
--- src/fpylll/algorithms/bkz.py.orig 2018-05-24 06:36:45.000000000 -0600
+++ src/fpylll/algorithms/bkz.py 2019-06-28 11:51:09.775121036 -0600
@@ -78,7 +78,7 @@ class BKZReduction(object):
if params.flags & BKZ.AUTO_ABORT:
auto_abort = BKZ.AutoAbort(self.M, self.A.nrows)
- cputime_start = time.clock()
+ cputime_start = time.perf_counter()
with tracer.context("lll"):
self.lll_obj()
@@ -94,7 +94,7 @@ class BKZReduction(object):
break
if (params.flags & BKZ.MAX_LOOPS) and i >= params.max_loops:
break
- if (params.flags & BKZ.MAX_TIME) and time.clock() - cputime_start >= params.max_time:
+ if (params.flags & BKZ.MAX_TIME) and time.perf_counter() - cputime_start >= params.max_time:
break
tracer.exit()
diff -up src/fpylll/tools/bkz_stats.py.orig src/fpylll/tools/bkz_stats.py
--- src/fpylll/tools/bkz_stats.py.orig 2018-05-24 06:36:45.000000000 -0600
+++ src/fpylll/tools/bkz_stats.py 2019-06-28 11:52:08.285994460 -0600
@@ -669,7 +669,7 @@ class TimeTreeTracer(Tracer):
"""
node = self.current
- node.data["cputime"] = node.data.get("cputime", 0) + Accumulator(-time.clock(), repr="sum", count=False)
+ node.data["cputime"] = node.data.get("cputime", 0) + Accumulator(-time.perf_counter(), repr="sum", count=False)
node.data["walltime"] = node.data.get("walltime", 0) + Accumulator(-time.time(), repr="sum", count=False)
def exit(self, **kwds):
@@ -685,7 +685,7 @@ class TimeTreeTracer(Tracer):
node = self.current
- node.data["cputime"] += time.clock()
+ node.data["cputime"] += time.perf_counter()
node.data["walltime"] += time.time()
if self.verbosity and self.verbosity >= self.current.level:
@@ -730,7 +730,7 @@ class BKZTreeTracer(Tracer):
"""
node = self.current
- node.data["cputime"] = node.data.get("cputime", 0) + Accumulator(-time.clock(), repr="sum", count=False)
+ node.data["cputime"] = node.data.get("cputime", 0) + Accumulator(-time.perf_counter(), repr="sum", count=False)
node.data["walltime"] = node.data.get("walltime", 0) + Accumulator(-time.time(), repr="sum", count=False)
def exit(self, **kwds): # noqa, shut up linter about this function being too complex
@@ -741,7 +741,7 @@ class BKZTreeTracer(Tracer):
node = self.current
label = node.label
- node.data["cputime"] += time.clock()
+ node.data["cputime"] += time.perf_counter()
node.data["walltime"] += time.time()
if label == "enumeration":
diff -up tests/test_pruner.py.orig tests/test_pruner.py
--- tests/test_pruner.py.orig 2018-05-24 06:36:45.000000000 -0600
+++ tests/test_pruner.py 2019-06-28 11:49:44.649760050 -0600
@@ -2,7 +2,7 @@
from fpylll import Enumeration, GSO, IntegerMatrix, LLL, Pruning
from fpylll.util import gaussian_heuristic
-from time import clock
+from time import perf_counter
dim_oh = ((40, 2**22), (41, 2**22), (50, 2**24), (51, 2**24))
@@ -30,9 +30,9 @@ def test_pruner():
print(" \n GREEDY")
radius = gaussian_heuristic(r) * 1.6
print("pre-greedy radius %.4e" % radius)
- tt = clock()
+ tt = perf_counter()
pruning =Pruning.run(radius, overhead, r, 200, flags=Pruning.ZEALOUS, metric="solutions")
- print("Time %.4e"%(clock() - tt))
+ print("Time %.4e"%(perf_counter() - tt))
print("post-greedy radius %.4e" % radius)
print(pruning)
print("cost %.4e" % sum(pruning.detailed_cost))
@@ -43,9 +43,9 @@ def test_pruner():
print(" \n GREEDY \n")
print("pre-greedy radius %.4e" % radius)
- tt = clock()
+ tt = perf_counter()
pruning = Pruning.run(radius, overhead, r, 200, flags=Pruning.ZEALOUS, metric="solutions")
- print("Time %.4e"%(clock() - tt))
+ print("Time %.4e"%(perf_counter() - tt))
print("post-greedy radius %.4e" % radius)
print(pruning)
print("cost %.4e" % sum(pruning.detailed_cost))
@@ -57,9 +57,9 @@ def test_pruner():
print(" \n GRADIENT \n")
print("radius %.4e" % radius)
- tt = clock()
+ tt = perf_counter()
pruning = Pruning.run(radius, overhead, r, 200, flags=Pruning.GRADIENT, metric="solutions")
- print("Time %.4e"%(clock() - tt))
+ print("Time %.4e"%(perf_counter() - tt))
print(pruning)
print("cost %.4e" % sum(pruning.detailed_cost))
solutions = Enumeration(M, nr_solutions=10000).enumerate(0, n, radius, 0, pruning=pruning.coefficients)
@@ -70,9 +70,9 @@ def test_pruner():
print(" \n HYBRID \n")
print("radius %.4e" % radius)
- tt = clock()
+ tt = perf_counter()
pruning = Pruning.run(radius, overhead, r, 200, flags=Pruning.ZEALOUS, metric="solutions")
- print("Time %.4e"%(clock() - tt))
+ print("Time %.4e"%(perf_counter() - tt))
print(pruning)
print("cost %.4e" % sum(pruning.detailed_cost))
solutions = Enumeration(M, nr_solutions=10000).enumerate(0, n, radius, 0, pruning=pruning.coefficients)