Skip to content

Commit 23dd19c

Browse files
committed
reduced use of very slow pprint.pformat, especially for debug logging
1 parent 47f9f68 commit 23dd19c

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

gp_learner.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
import random
2222
from time import sleep
2323
from datetime import datetime
24-
import pprint
25-
from pprint import pformat
26-
# speeds up pformat at the cost of warning handling
27-
pprint._sorted = lambda x: sorted(x)
2824

2925
from cachetools import lru_cache
3026
import deap

gp_query.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from collections import Sequence
1111

1212
import logging
13-
from pprint import pformat
1413
import re
1514
import socket
1615
from time import sleep
@@ -409,8 +408,7 @@ def _query(
409408
else:
410409
logger.debug('cache hit')
411410
t, res = c
412-
if logger.isEnabledFor(logging.DEBUG):
413-
logger.debug('orig query took %.4f s, result:\n%s\n', t, pformat(res))
411+
logger.debug('orig query took %.4f s, result:\n%s\n', t, res)
414412
return t, res
415413

416414

0 commit comments

Comments
 (0)