mirror of
https://github.com/chylex/IntelliJ-AceJump.git
synced 2025-03-10 19:32:21 +01:00
Decide whether to use parallel search based on search boundary size
This commit is contained in:
parent
000a57824a
commit
3c899bf595
src/main/kotlin/org/acejump
@ -1,9 +1,7 @@
|
||||
package org.acejump.search
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.acejump.view.Boundary.FULL_FILE_BOUNDARY
|
||||
import org.acejump.view.Model.LONG_DOCUMENT
|
||||
import org.acejump.view.Model.boundaries
|
||||
import org.acejump.view.Model.LONG_DOCUMENT_LENGTH
|
||||
import org.acejump.view.Model.editorText
|
||||
import java.util.*
|
||||
import kotlin.streams.toList
|
||||
@ -23,7 +21,7 @@ internal object Scanner {
|
||||
*/
|
||||
|
||||
fun find(model: AceFindModel, boundaries: IntRange, cache: Set<Int> = emptySet()): SortedSet<Int> =
|
||||
if (!LONG_DOCUMENT || cache.size != 0 || boundaries != FULL_FILE_BOUNDARY.intRange())
|
||||
if (cache.isNotEmpty() || (boundaries.last - boundaries.first) < LONG_DOCUMENT_LENGTH)
|
||||
editorText.search(model, cache, boundaries).toSortedSet()
|
||||
else editorText.chunk().parallelStream().map { chunk ->
|
||||
editorText.search(model, cache, chunk)
|
||||
|
@ -56,9 +56,9 @@ object Model {
|
||||
get() = lineHeight - (editor as EditorImpl).descent - fontHeight
|
||||
val arcD = rectHeight - 6
|
||||
var viewBounds = 0..0
|
||||
const val DEFAULT_BUFFER = 30000
|
||||
const val LONG_DOCUMENT_LENGTH = 100000
|
||||
val LONG_DOCUMENT
|
||||
get() = DEFAULT_BUFFER < editorText.length
|
||||
get() = LONG_DOCUMENT_LENGTH < editorText.length
|
||||
const val MAX_TAG_RESULTS = 300
|
||||
|
||||
val defaultBoundary = FULL_FILE_BOUNDARY
|
||||
|
Loading…
Reference in New Issue
Block a user