Volt-core React Native bindings - 12x parallel performance for mobile computation with custom functions and face recognition
npm install volt-core-react-nativebash
npm install @volt-core/react-native
or
yarn add @volt-core/react-native
`
Requirements:
- React Native ≥ 0.73
- iOS 12+ (for arm64 support)
- Android API 21+ (for NDK support)
- Rust 1.70+ (for building)
Quick Start
`javascript
import VoltCore, { particleSimulation } from '@volt-core/react-native';
// Get system info
const info = await VoltCore.info();
console.log(${info.cores_available} cores available);
// Run particle simulation (10K particles, 120fps)
const { positions, time_ms } = await particleSimulation(10000, 60);
console.log(Simulated 10K particles in ${time_ms}ms);
// Image processing (gaussian blur)
import { gaussianBlur } from '@volt-core/react-native';
const blurred = await gaussianBlur(imagePixels, width, height, kernelSize);
`
API
$3
Get available cores and feature support:
`javascript
const { version, cores_available, supports_crypto } = await VoltCore.info();
`
$3
Execute single computation:
`javascript
const result = await VoltCore.compute({
operation: 'gaussian_blur',
data: imagePixels,
params: { width: 1920, height: 1080, kernel_size: 5 }
});
// => { result: [...], cores_used: 8, execution_time_ms: 12 }
`
$3
Parallel execution of multiple tasks:
`javascript
const results = await VoltCore.computeBatch([
{ operation: 'sort_parallel', data: array1 },
{ operation: 'matrix_multiply', data: array2, params: { scale: 10 } },
{ operation: 'gaussian_blur', data: pixels, params: { width: 1080, height: 1920 } }
]);
// All 3 tasks run in parallel, using all available cores
`
$3
Simulate particles with physics:
`javascript
const animation = await VoltCore.animateParticles(10000, 120, {
gravity: 0.1,
friction: 0.99,
spawn_radius: 50
});
// => { final_positions: [{x, y}, ...], execution_time_ms: 416 }
`
Performance Benchmarks (iPhone 15 Pro):
- 1K particles: 4ms (300fps-capable)
- 5K particles: 20ms (50fps)
- 10K particles: 42ms (≈24fps) ← Real-time capable
- 50K particles: 220ms (~4fps, batch processing)
$3
Image Processing:
`javascript
import { gaussianBlur, edgeDetect } from '@volt-core/react-native';
// Blur (5px kernel)
const blurred = await gaussianBlur(pixels, width, height, 5);
// Edge detection (Sobel)
const edges = await edgeDetect(pixels, width, height);
`
Data Processing:
`javascript
import { sortParallel, reduceSum, matrixMultiply } from '@volt-core/react-native';
// Sort 1M elements in parallel
const sorted = await sortParallel(largeArray);
// Sum 10M elements
const sum = await reduceSum(largeArray);
// 1000×1000 matrix multiplication
const result = await matrixMultiply(matrixA, matrixB, 1000);
`
Operations (20 total)
| Operation | Input | Output | Use Case |
|-----------|-------|--------|----------|
| gaussian_blur | pixels[W×H] | blurred[W×H] | Photo filters, blur effects |
| edge_detect | pixels[W×H] | edges[W×H] | Computer vision, canny |
| sort_parallel | numbers[] | sorted[] | Large array sorting |
| matrix_multiply | [size²] | [size²] | Linear algebra, ML |
| json_parse | JSON string | parsed object | Large document parsing |
| fft_forward | time[1024] | freq[512] | Audio analysis, DSP |
| reduce_sum | numbers[] | sum: number | Analytics aggregation |
| map_parallel | numbers[] | mapped[] | Functional programming |
| particle_update | particles[] | updated[] | Game physics |
| physics_sim | objects[] | positions[] | Collision detection |
| PRO Operations (Available with tier=pro): | | | |
| sha256_hash | bytes[] | hash[32] | Security, integrity checks |
| aes_encrypt | data[] | cipher[] | Encrypted storage |
| crypto_sign | data[] | signature[64] | Digital signatures |
| compress | data[] | compressed[] | Data transmission |
| color_enhance | pixels[] | enhanced[] | Image post-processing |
| tensor_dot | tensor[] | result[] | Neural network inference |
| video_encode | frames[] | encoded[] | Video recording |
| frame_resize | frame[W×H] | resized[] | Resolution scaling |
| face_detect | pixels[W×H] | faces[] | Face recognition |
| generic_cpu | data[] | computed[] | Custom CPU workloads |
Building from Source
$3
`bash
Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install Rust targets for mobile
rustup target add aarch64-apple-ios x86_64-apple-ios
rustup target add armv7-linux-androideabi aarch64-linux-android x86_64-linux-android
Install cargo-ndk and cargo-lipo
cargo install cargo-ndk cargo-lipo
`
$3
`bash
Build for iOS (creates .xcframework)
npm run build:ios
Build for Android (creates .so files for all architectures)
npm run build:android
Build both (recommended)
npm run build
`
Architecture
`
packages/react-native/
├── index.js # Native module bridge layer
├── index.d.ts # TypeScript definitions
├── package.json # npm metadata
├── ios/ # iOS native module
│ ├── VoltCoreRN.swift # Swift wrapper
│ ├── bridge.rs # Rust-to-iOS FFI
│ └── VoltCoreRN.podspec
└── android/ # Android native module
├── VoltCoreRN.kt # Kotlin wrapper
├── build.gradle # Android build config
└── src/main/... # JNI bindings
`
Performance Comparison
$3
| Platform | Free Tier | Pro Tier |
|----------|-----------|----------|
| JavaScript | 2840ms | N/A |
| volt-core RN (iOS) | 240ms | 45ms |
| Speedup | 11.8x | 63x |
$3
| Platform | Exec Time |
|----------|-----------|
| JS (WASM fallback) | 850ms |
| volt-core RN | 68ms |
| Speedup | 12.5x |
$3
| Platform | Free | Pro |
|----------|------|-----|
| Canvas.js | 2100ms | N/A |
| volt-core RN | 42ms | 28ms |
| FPS Sustained | ~24fps | ~36fps |
Monetization
Free Tier:
- Up to 4 cores
- Core operations (sort, blur, matrix)
- Perfect for indie developers
Pro Tier:
- All available cores (up to 12 on flagship phones)
- Crypto operations (AES, SHA256, RSA)
- Video encoding, face detection
- GitHub Sponsors: $19/month
Troubleshooting
$3
`bash
Ensure NDK is installed
On macOS: brew install android-ndk
On Linux: export ANDROID_NDK_HOME=~/Android/Ndk/27.0.12077973
cargo-ndk -t arm64-v8a build --release
`
$3
`bash
Rebuild pods and clean Xcode cache
cd ios
pod install --repo-update
cd ..
xcode clean
`
$3
- Verify minSdkVersion ≥ 21 in android/build.gradle
- Check that native library (.so) is included in APK: unzip -l app-release.apk | grep .so`