simd-wasm-sort
v0.3.0
Published
Sort variation in WebAssembly SIMD C implementation
Readme
simd-wasm-sort
Sort variation in WebAssembly SIMD C implementation.
What is this?
WebAssembly supports SIMD instructions. This project provides high-performance sort functions that use WASM SIMD instructions.
The implementation is written in C using the Emscripten SDK. With emsdk-env, you can easily use it via a package reference.
Installation
$ npm install -D simd-wasm-sortUsage
You can use it from Emscripten C/C++ code:
// Refer to simd-wasm-sort definitions
#include <simdsort.h>
// WASM entry point
void sort_data(int32_t *data, int32_t count) {
// :
// :
// Run the sort
simd_stable_sort_int32(data, count);
// :
// :
}Example for vite.config.ts (emsdk-env):
import { defineConfig } from 'vite';
import emsdkEnv from 'emsdk-env/vite';
export default defineConfig({
plugins: [
// Use emsdk-env plugin
emsdkEnv({
imports: ['simd-wasm-sort'], // Use simd-wasm-sort package
targets: {
// Your WASM output target "compute.wasm"
compute: {
// Linker options
linkOptions: ['-lsimdsort'], // Refer libsimdsort.a
// :
// :
},
},
}),
],
});Documents
For more information, please visit repository and refer README: simd-wasm-sort
License
Under MIT.
