From 54467df8c6f06c2d4421ab5d0446d7cd8f5040e1 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 13 Sep 2020 16:27:34 +0100 Subject: Add comment about performance for text() --- jq.pyx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jq.pyx b/jq.pyx index cbb7b5d..7577ae5 100644 --- a/jq.pyx +++ b/jq.pyx @@ -254,6 +254,10 @@ cdef class _ProgramWithInput(object): return _ResultIterator(self._jq_state_pool, self._bytes_input) def text(self): + # Performance testing suggests that using _jv_to_python (within the + # result iterator) followed by json.dumps is faster than using + # jv_dump_string to generate the string directly from the jv values. + # See: https://github.com/mwilliamson/jq.py/pull/50 return "\n".join(json.dumps(v) for v in self) def all(self): -- cgit v1.2.3