Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment: only sample compact words and use better 64-bit hash in zhenya test #108

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
MOC_VERSION: 0.10.4
IC_WASM_VERSION: 0.7.0
RUSTC_VERSION: 1.75.0
MOC_ARTIFACT: 1242507845
steps:
- uses: actions/checkout@v3
- name: Checkout out gh-pages report
Expand Down Expand Up @@ -64,9 +65,10 @@ jobs:
chmod a+x /usr/local/bin/ic-repl
npm i -g ic-mops
dfx cache install
cd $(dfx cache show)
wget https://github.com/dfinity/motoko/releases/download/$MOC_VERSION/motoko-Darwin-x86_64-$MOC_VERSION.tar.gz
tar zxvf motoko-Darwin-x86_64-$MOC_VERSION.tar.gz
wget https://nightly.link/dfinity/motoko/actions/artifacts/$MOC_ARTIFACT.zip
unzip $MOC_ARTIFACT.zip
chmod a+x bin/moc
cp -rf bin/moc $(dfx cache show)
wget https://github.com/dfinity/ic-wasm/releases/download/$IC_WASM_VERSION/ic-wasm-macos
cp ./ic-wasm-macos /usr/local/bin/ic-wasm
chmod a+x /usr/local/bin/ic-wasm
Expand Down
7 changes: 3 additions & 4 deletions collections/motoko/src/ZhenyaHashmap.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import Iter "mo:base/Iter";
import Option "mo:base/Option";
import Random "random";
import Profiling "../../../utils/motoko/Profiling";

import Prim "mo:prim";
actor {
stable let profiling = Profiling.init();

func f_hash(x : Nat64) : Nat32 = Hash.hash(Nat64.toNat x);
let hash : HashMap.HashUtils<Nat64> = (f_hash, Nat64.equal);

let hash : HashMap.HashUtils<Nat64> = Map.n64hash;
crusso marked this conversation as resolved.
Show resolved Hide resolved
stable var map = HashMap.new<Nat64, Nat64>();
let rand = Random.new(null, 42);

Expand Down
2 changes: 1 addition & 1 deletion collections/motoko/src/hashmap.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Profiling "../../../utils/motoko/Profiling";

actor {
stable let profiling = Profiling.init();

crusso marked this conversation as resolved.
Show resolved Hide resolved
func hash(x: Nat64) : Nat32 = Hash.hash(Nat64.toNat x);
var map = HashMap.HashMap<Nat64, Nat64>(0, Nat64.equal, hash);
stable var stableMap: [(Nat64, Nat64)] = [];
Expand Down
2 changes: 1 addition & 1 deletion collections/motoko/src/random.mo
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module {
};
};
state := state * 48271 % modulus;
?state;
?(state >> 4);
};
};
public func get_memory(): (Nat,Nat,Nat) {
Expand Down
Loading