7730b6993f
- Create assembly/vm.ts with full RandomX VM implementation
- 256 instructions, 2048 iterations per hash
- Native u64/f64 operations in WebAssembly
- Full mode dataset lookups (2GB pre-computed)
- Update miner to use WASM VM for full mode
- mining-worker-asm.js uses pre-compiled WASM
- ~32 H/s per thread (4x faster than light mode)
- 8 threads achieves ~260 H/s
- Clean up redundant code
- Remove mining-worker-full.js (old JIT approach)
- Consolidate 'asm' mode into 'full' mode
37 lines
998 B
JavaScript
37 lines
998 B
JavaScript
/**
|
|
* Debug: Cache initialization only (no dataset)
|
|
*/
|
|
|
|
import { RandomXCache } from '../src/randomx/dataset.js';
|
|
|
|
console.log('=== Cache Init Test ===\n');
|
|
|
|
const key = new TextEncoder().encode('test key 000');
|
|
|
|
console.log('Initializing cache (256MB, 3 passes)...');
|
|
const startTime = Date.now();
|
|
const cache = new RandomXCache();
|
|
|
|
// Init
|
|
cache.init(key, (percent, pass, slice) => {
|
|
if (percent % 25 === 0) {
|
|
console.log(`Cache init: ${percent}% (pass ${pass + 1}, slice ${slice})`);
|
|
}
|
|
});
|
|
|
|
const cacheTime = Date.now() - startTime;
|
|
console.log(`\nCache initialized in ${cacheTime}ms`);
|
|
console.log(`Cache memory size: ${cache.memory.length / 1024 / 1024}MB`);
|
|
|
|
// Check first few bytes
|
|
function readU64LE(bytes, offset = 0) {
|
|
let val = 0n;
|
|
for (let i = 0; i < 8; i++) {
|
|
val |= BigInt(bytes[offset + i]) << BigInt(i * 8);
|
|
}
|
|
return val;
|
|
}
|
|
|
|
console.log(`\nCache memory[0] = 0x${readU64LE(cache.memory, 0).toString(16)}`);
|
|
console.log(`Expected: 0x191e0e1d23c02186`);
|