interning strings to fix memory consumption

This commit is contained in:
Bryan Marcus McCann 2018-08-21 02:47:14 +00:00
parent d776d9f600
commit 1f83b7a739
2 changed files with 3 additions and 1 deletions

View File

@ -64,5 +64,6 @@ RUN apt-get install --yes \
RUN pip install records
RUN pip install babel
RUN pip install tabulate
RUN pip install pympler
CMD bash

View File

@ -1,5 +1,6 @@
import csv
import json
import sys
import six
@ -58,7 +59,7 @@ class Example(object):
if field is not None:
if isinstance(val, six.string_types):
val = val.rstrip('\n')
setattr(ex, name, field.preprocess(val))
setattr(ex, name, [sys.intern(x) for x in field.preprocess(val)])
return ex
@classmethod