gannan08 / rdf-canonize-rs Goto Github PK
View Code? Open in Web Editor NEWPlease see https://github.com/digitalbazaar/rdf-canonize-rs
License: BSD 3-Clause "New" or "Revised" License
Please see https://github.com/digitalbazaar/rdf-canonize-rs
License: BSD 3-Clause "New" or "Revised" License
TLDR; hash_first_degree_quads
is a good target for optmizations. I'll be doing another breakdown for that function.
https://github.com/gannan08/rdf-canonize-rust/blob/main/src/urdna2015.rs#L58-L97
https://github.com/gannan08/rdf-canonize-rust/blob/main/src/urdna2015.rs#L61-L68
https://github.com/gannan08/rdf-canonize-rust/blob/main/src/urdna2015.rs#L83-L89
hash_first_degree_quads
looks like this (don't mind the rounding)https://github.com/gannan08/rdf-canonize-rust/blob/main/src/urdna2015.rs#L246-L340
FIRST_DEGREE_QUADS_1 39
FIRST_DEGREE_QUADS_1 61
FIRST_DEGREE_QUADS_1 1
FIRST_DEGREE_QUADS_1 6
FIRST_DEGREE_QUADS_1 1
FIRST_DEGREE_QUADS_1 10
https://github.com/gannan08/rdf-canonize-rust/blob/main/src/urdna2015.rs#L98-L119
https://github.com/gannan08/rdf-canonize-rust/blob/main/src/urdna2015.rs#L174-L236
First, I want to make sure you're aware of this branch and its capabilities:
Secondly, by adding timers and an accumulator, I have discovered that 2/3 of the time spent doing test044_canonize
is in this one function:
Presently, total runtime is approx 3ms for that test, and 1.95ms of that time is spent in create_hash_to_related
.
The amazing thing is, that 24 hours ago a test iteration was 9-10ms!
I've been journaling progress here: https://app.gitbook.com/@digitalbazaar/s/rust/v/master/rdf-canonize-optimizations
I'm going to get a start on this. I'll report my progress here.
Working here: https://github.com/gannan08/rdf-canonize-rust/tree/nquad-dataset-rio
I was curious to know if we were dealing with a pure crypto race so I put this together:
https://github.com/mattcollier/rust-hash-bench
Which goes with this: https://github.com/digitalbazaar/loop-bench/blob/rdf-canonize-local-native/index25.js
which shows this for the default 1M operations.
NODEJS MS 3013.116585
RUST MS 1916.46965
Rust wins for big and small numbers of operations.
This test demonstrates the failure:
The assertion will pass if the created
date is modified to 2020-12-29T21:12:26
https://github.com/digitalbazaar/loop-bench/blob/b066d4782f20fb6ff6fc1d916ffe0d043f33b0aa/index23.js#L42
The assertion also fails if L42 is removed entirely.
Looks like we just need to wire what you have here into this: https://github.com/mattcollier/rust-node-bindgen-canonize/blob/9aecb5646dfcbc2d633495a5b09fdfa712cece15/src/lib.rs#L79-L80
I've tested this and it will accept the inputs from rdf-canonize tests.
You just need nj-cli to build the bindgen-canonize stuff: https://github.com/infinyon/node-bindgen#cli-installation
// within the rust-node-bindgen-canonize folder
nj-cli build
const rustCanonize = require('../../rust-bindgen-canonize/dist/index.node');
// in the rdf-canonize test suite
result = canonize.canonize.apply(null, clone(jsParams));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.