diff options
author | Davies Liu <davies@databricks.com> | 2014-11-21 15:02:31 -0800 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2014-11-21 15:02:31 -0800 |
commit | ce95bd8e130b2c7688b94be40683bdd90d86012d (patch) | |
tree | 396d4e26517f3fc6e84a904ca6466ffb5da2f222 /python/pyspark/mllib/common.py | |
parent | a81918c5a66fc6040f9796fc1a9d4e0bfb8d0cbe (diff) | |
download | spark-ce95bd8e130b2c7688b94be40683bdd90d86012d.tar.gz spark-ce95bd8e130b2c7688b94be40683bdd90d86012d.tar.bz2 spark-ce95bd8e130b2c7688b94be40683bdd90d86012d.zip |
[SPARK-4531] [MLlib] cache serialized java object
The Pyrolite is pretty slow (comparing to the adhoc serializer in 1.1), it cause much performance regression in 1.2, because we cache the serialized Python object in JVM, deserialize them into Java object in each step.
This PR change to cache the deserialized JavaRDD instead of PythonRDD to avoid the deserialization of Pyrolite. It should have similar memory usage as before, but much faster.
Author: Davies Liu <davies@databricks.com>
Closes #3397 from davies/cache and squashes the following commits:
7f6e6ce [Davies Liu] Update -> Updater
4b52edd [Davies Liu] using named argument
63b984e [Davies Liu] fix
7da0332 [Davies Liu] add unpersist()
dff33e1 [Davies Liu] address comments
c2bdfc2 [Davies Liu] refactor
d572f00 [Davies Liu] Merge branch 'master' into cache
f1063e1 [Davies Liu] cache serialized java object
Diffstat (limited to 'python/pyspark/mllib/common.py')
-rw-r--r-- | python/pyspark/mllib/common.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/python/pyspark/mllib/common.py b/python/pyspark/mllib/common.py index c6149fe391..33c49e2399 100644 --- a/python/pyspark/mllib/common.py +++ b/python/pyspark/mllib/common.py @@ -54,15 +54,13 @@ _picklable_classes = [ # this will call the MLlib version of pythonToJava() -def _to_java_object_rdd(rdd, cache=False): +def _to_java_object_rdd(rdd): """ Return an JavaRDD of Object by unpickling It will convert each Python object into Java object by Pyrolite, whenever the RDD is serialized in batch or not. """ rdd = rdd._reserialize(AutoBatchedSerializer(PickleSerializer())) - if cache: - rdd.cache() return rdd.ctx._jvm.SerDe.pythonToJava(rdd._jrdd, True) |