mridulm commented on code in PR #42742:
URL: https://github.com/apache/spark/pull/42742#discussion_r1312531275
##########
core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala:
##########
@@ -220,7 +220,8 @@ private[spark] class MemoryStore(
}
// Unroll this block safely, checking whether we have exceeded our
threshold periodically
- while (values.hasNext && keepUnrolling) {
+ // and if no thread interrupts have been received.
+ while (values.hasNext && keepUnrolling &&
!Thread.currentThread().isInterrupted) {
Review Comment:
I am slightly wary of calling `isInterrupted` for every iteration.
Given we already have the `if (elementsUnrolled ...` condition below, do we
want to move it to that ?
IIRC `isInterrupted` is a couple of orders more expensive than a boolean
check.
Something like:
```
var interrupted = false
while (values.hasNext && keepUnrolling && !interrupted) {
valuesHolder ...
if (elementsUnrolled ... ){
interrupted = Thread.currentThread().isInterrupted
...
}
elementsUnrolled += 1
}
if (interrupted) {
...
} else if (keepUnrolling) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]