interning strings to fix memory consumption
This commit is contained in:
parent
d776d9f600
commit
1f83b7a739
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue