Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/5173#discussion_r27268071
--- Diff: python/pyspark/context.py ---
@@ -456,7 +463,7 @@ def _dictToJavaMap(self, d):
jm = self._jvm.java.util.HashMap()
if not d:
d = {}
- for k, v in d.iteritems():
+ for k, v in d.items():
--- End diff --
The overhead of items() for dict with 1 million items is just 80 ms, so I'd
like go with it.
```
davies@localhost:~/work/spark$ python -m timeit -s
"d=dict(zip(range(1<<20), range(1<<20)))" -c "sum(1 for _ in d.iteritems())"
10 loops, best of 3: 80.7 msec per loop
davies@localhost:~/work/spark$ python -m timeit -s
"d=dict(zip(range(1<<20), range(1<<20)))" -c "sum(1 for _ in d.items())"
10 loops, best of 3: 162 msec per loop
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]