Files
salvium-rs/test/check-vm-memory.js
T
Matt Hess 7730b6993f ● Add AssemblyScript WASM VM for RandomX full mode
- 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
2026-01-18 01:16:10 +00:00

17 lines
586 B
JavaScript

import { randomx_init_cache, randomx_create_vm } from '../src/randomx/vendor/index.js';
const cache = randomx_init_cache('test');
console.log('Cache memory:');
console.log(' buffer size:', cache.memory.buffer.byteLength);
console.log(' pages:', cache.memory.buffer.byteLength / 65536);
// The vendored library creates VM successfully - let's examine it
const vm = randomx_create_vm(cache);
console.log('\nVM created successfully');
console.log('VM methods:', Object.keys(vm));
// Check if we can hash
const hash = vm.calculate_hex_hash('test');
console.log('\nTest hash:', hash);