A JavaFX application for implementing, testing, and benchmarking three core string search algorithms: Rabin-Karp, Boyer-Moore, and Knuth-Morris-Pratt (KMP). Features virtualized rendering for large documents and real-time performance analysis.
Cyberpunk Search Studio provides an interactive environment for comparing classical string search algorithms on real text data. The application handles large documents efficiently and includes comprehensive benchmarking tools for performance analysis.
Key Features
- 🔍 Three Core Algorithms: Rabin-Karp (3 variants), Boyer-Moore, and KMP
- ⚡ Virtualized Rendering: Smooth handling of large documents (millions of characters)
- 📊 Performance Benchmarking: Compare algorithm execution times on actual loaded content
- 🎯 Search Modes: Substring, starts-with, and whole-word matching
- 🔄 Search & Replace: Find and replace with visual feedback
- 💾 File Operations: Load and save text documents
Figure 1: Main application interface with search toolbar and text viewport
|
Rolling Hash Three implementations:
Best For: Large texts, multilingual content |
Right-to-Left Matching Uses bad character and good suffix rules
Best For: Long patterns, general-purpose |
Linear-Time Algorithm LPS array preprocessing
Best For: Guaranteed performance, streaming |
Additional algorithms (Naive, Horspool, Bitap, Z-Algorithm) are included for benchmark comparison purposes.
💡 Rabin-Karp Hash Parameters:
Base:65,537| Modulus:1,000,000,007
Supports Unicode, emojis, and multilingual text
Figure 2: Dropdown Menu to select which algorithm to use in search
💡 Quick Start: Launch → Load File → Select Algorithm → Enter Pattern → Click SEARCH
| Step | Action |
|---|---|
| 1️⃣ | Launch Application: Run JAR file or execute from IDE |
| 2️⃣ | Default Text: Application loads with sample text pre-loaded |
- Click the LOAD button in the top toolbar
- Select any text file (UTF-8 encoded)
- The document will load and display in the center view
Step-by-Step Process:
- Select Algorithm → Choose from dropdown (default:
RABIN-KARP 3 (Opt)) - Choose Search Mode:
- 📄
SUBSTRING- Find pattern anywhere in text - 🔤
STARTS_WITH- Pattern must start at word boundaries - 📝
WHOLE_WORD- Pattern must match complete words
- 📄
- Toggle Case → Check
IGNORE CASEfor case-insensitive search - Enter Pattern → Type search text (default:
"you") - Click
SEARCH→ Matches highlighted in cyan with glow effects - View Results → Command log shows match count and execution time
- Perform a search first (establishes match positions)
- Enter Replacement: Type replacement text in the "Replace..." field
- Click REPLACE: All matches are replaced in the document
- View Changes: Text updates immediately in the viewport
- Click SAVE AS button
- Choose location and filename
- File saves with all replacements applied
- Confirmation appears in command log
How to Run:
- 📂 Load your target document
- ✍️ Enter the search pattern you want to test
- 🎯 Click
BENCHMARK→ Switches to dashboard view - 📈 View Results:
- Each algorithm shows average execution time
- Visual bars compare relative performance
- 🏆 Winner highlighted in green
- Results sorted fastest → slowest
⚙️ Benchmark Process:
- 🔥 Warm-up: 10 iterations (JIT optimization)
- 📏 Measurement: 20 iterations (statistical accuracy)
- 📄 Uses your actual loaded document and pattern
- ⏱️ Reports average time in milliseconds
Figure 3, 4: Benchmarking Results
|
🔝 Top Toolbar
|
📱 Center View
|
📟 Bottom Panel
|
- Large Files: The viewport renders only visible text, so documents with millions of characters work smoothly
- Pattern Selection: Shorter patterns typically search faster across all algorithms
- Benchmark Accuracy: Use realistic patterns and actual working documents for meaningful comparisons
- Scrolling: After search, scroll through document to see all matches highlighted
- Multiple Searches: Each new search clears previous highlights
| Algorithm | Average Time | Space | Best Use Case |
|---|---|---|---|
| Rabin-Karp (Bitwise) | O(n + m) |
O(1) |
Large texts, multiple patterns |
| Boyer-Moore | O(n/m) |
O(m + σ) |
Long patterns, general use |
| KMP | O(n + m) |
O(m) |
Guaranteed linear time |
n = text length, m = pattern length, σ = alphabet size
|
java -jar cyberpunk-search-studio.jar |
# With Maven
mvn clean package
java --module-path /path/to/javafx-sdk/lib \
--add-modules javafx.controls \
-jar target/search-benchmark.jar|
📚 Compare and understand classical search algorithms |
⚡ Benchmark algorithms on real-world data |
📝 Search and replace in large documents |
🔬 Analyze algorithm behavior with different patterns |
Typical results on a 1MB text file:
🏆 RABIN-KARP 3 (Opt) : 0.0234 ms (Winner)
🥈 Boyer-Moore : 0.0312 ms
🥉 KMP : 0.0389 ms
Results vary based on hardware, document characteristics, and pattern complexity
|
|



