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: duplicate of #108 using most recent artifact. #109

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 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
crusso marked this conversation as resolved.
Show resolved Hide resolved
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
13 changes: 9 additions & 4 deletions collections/motoko/src/ZhenyaHashmap.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ 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);

// avoid boxed hashes
func hashNat64(key: Nat64) : Nat32 {
Prim.nat64ToNat32(key & 0x7ff_ffff); // Nat32 is 27-bit
};

let hash : HashMap.HashUtils<Nat64> = (hashNat64, func (x,y) = x == y);

stable var map = HashMap.new<Nat64, Nat64>();
let rand = Random.new(null, 42);

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

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

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);
crusso marked this conversation as resolved.
Show resolved Hide resolved
};
};
public func get_memory(): (Nat,Nat,Nat) {
Expand Down
Loading