mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-22 17:02:13 +00:00
Fix after merge
This commit is contained in:
parent
d9506ca5d5
commit
0c19824425
@ -7,7 +7,7 @@ use cranelift_wasm;
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use wasmer_runtime_core::cache::{Artifact, Error as CacheError, WasmHash};
|
use wasmer_runtime_core::cache::{Artifact, Error as CacheError};
|
||||||
|
|
||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
backend::Backend,
|
backend::Backend,
|
||||||
|
@ -75,7 +75,6 @@ struct ArtifactHeader {
|
|||||||
magic: [u8; 8], // [W, A, S, M, E, R, \0, \0]
|
magic: [u8; 8], // [W, A, S, M, E, R, \0, \0]
|
||||||
version: u64,
|
version: u64,
|
||||||
data_len: u64,
|
data_len: u64,
|
||||||
wasm_hash: [u8; 64], // Sha256 of the wasm in binary format.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArtifactHeader {
|
impl ArtifactHeader {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
backend::{Backend, FuncResolver, ProtectedCaller},
|
backend::{Backend, FuncResolver, ProtectedCaller},
|
||||||
cache::{Artifact, Error as CacheError, WasmHash},
|
cache::{Artifact, Error as CacheError},
|
||||||
error,
|
error,
|
||||||
import::ImportObject,
|
import::ImportObject,
|
||||||
structures::{Map, TypedIndex},
|
structures::{Map, TypedIndex},
|
||||||
|
@ -14,7 +14,7 @@ fn compile_module() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn load_module(hash: WasmHash, cache: &impl Cache) {
|
fn load_module(hash: WasmHash, cache: &impl Cache) {
|
||||||
cache.load(hash).unwrap();
|
cache.load(hash).expect("could not load module");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hashing_benchmark(c: &mut Criterion) {
|
fn hashing_benchmark(c: &mut Criterion) {
|
||||||
@ -31,10 +31,15 @@ fn compile_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
fn load_benchmark(c: &mut Criterion) {
|
fn load_benchmark(c: &mut Criterion) {
|
||||||
c.bench_function("nginx load", |b| {
|
c.bench_function("nginx load", |b| {
|
||||||
let mut cache = unsafe { FileSystemCache::new(tempdir().unwrap().path()).unwrap() };
|
let tempdir = tempdir().unwrap();
|
||||||
|
let mut cache = unsafe {
|
||||||
|
FileSystemCache::new(tempdir.path()).expect("unable to create file system cache")
|
||||||
|
};
|
||||||
let module = compile(NGINX_WASM).unwrap();
|
let module = compile(NGINX_WASM).unwrap();
|
||||||
cache.store(module).unwrap();
|
|
||||||
let wasm_hash = WasmHash::generate(NGINX_WASM);
|
let wasm_hash = WasmHash::generate(NGINX_WASM);
|
||||||
|
cache
|
||||||
|
.store(wasm_hash, module)
|
||||||
|
.expect("unable to store into cache");
|
||||||
|
|
||||||
b.iter(|| load_module(wasm_hash, &cache))
|
b.iter(|| load_module(wasm_hash, &cache))
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user