You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Programming in python based on lists and other collections. I think it's better to convert them instantly. I mean you should reduce switching between python and JVM. Take a look at this example:
while iterator.hasNext():
print iterator.next()
That needs switching to JVM for each item. But there isn't any need if you convert Java Iterable to python list. Or this one with same performance issue:
for i in range(arr.length):
print list[i]
The text was updated successfully, but these errors were encountered:
I don't agreed. The whole goal of iterator is to prevent to not duplicate the list memory, and instead, get the item one by one. If we add magic to use python list, the memory used would be at mimimun x2.
However, if you have the choice of using a list (if the initial object has a toList(), toArray(), or something like that), then use it!
Programming in python based on lists and other collections. I think it's better to convert them instantly. I mean you should reduce switching between python and JVM. Take a look at this example:
That needs switching to JVM for each item. But there isn't any need if you convert Java Iterable to python list. Or this one with same performance issue:
The text was updated successfully, but these errors were encountered: