Skip to content

Instantly share code, notes, and snippets.

Avatar
🐓

Julian Bruyat BruJu

🐓
View GitHub Profile
@BruJu
BruJu / Old TODO.md
Last active Jun 4, 2020
Rust Wasm Various Notes
View Old TODO.md

Former TODO that will not be executed because they are not relevant anymore :

  • Explore the string problems

    • Are UTF8 and UTF16 that different ?
    • Can we disable text encoder (probably not)
    • Can we build a Term type that relies on JsStrings ? (and are they efficient in the wasm bindgen context ?)
  • The macro is horrible, we could build :

    • A base struct WasmWrapper that uses a SophiaDataset and builds the RDF JS functions
    • A trait WasmWrapperRewritten that uses a base WasmWrapper and recalls its function
@BruJu
BruJu / new_with_same_indexes.rs
Created Jun 5, 2020
TreedDataset - new with same indexes
View new_with_same_indexes.rs
// At the moment, this code feels bad to write and seems unnecessary
// but it may not be that bad so I keep it here
// https://github.com/BruJu/Portable-Reasoning-in-Web-Assembly
// https://github.com/BruJu/WasmTreeDataset
impl TreedDataset {
pub fn new_with_same_indexes(&self) -> Self {
let base_index = vec!(self.base_tree.0.clone());
let optional_indexes = {
@BruJu
BruJu / README.md
Last active Jul 2, 2020
Benchmarking RDF JS Stores with Comunica SPARQL Engine using the BSBM benchmark
View README.md

Benchmarking RDF JS Stores with Comunica SPARQL Engine using the BSBM benchmark

In this gist, we try to benchmark my web assembly implementation of RDF.JS Stores on SPARQL requests.

The tools we use are :

  • Communica's SPARQL Engine which is used as an adapter of the RDF JS Source interface to a SPARQL interface.
  • BSBM Tools to build a dataset and benchmark the performances with their test driver

To benchmark RDF JS stores (N3 and my own implementation), we build a SPARQL end point with a code that is mostly a copy / paste from Comunica (see the sparqlendpointfromstore.js file). We use the BSBM Java test driver to benchmark.

@BruJu
BruJu / pika.cpp
Created Jun 23, 2020
Detective Pikaptcha
View pika.cpp
// https://www.codingame.com/ide/puzzle/detective-pikaptcha-ep2
#include <iostream>
#include <vector>
#include <optional>
enum class Direction {
TOP, BOT, LEFT, RIGHT
};
View OxiJSEndPoint.md
@BruJu
BruJu / pinkinvisibleunicorn.rs
Created Jul 1, 2020
Rust BTreeSet::Range::size_hint testing
View pinkinvisibleunicorn.rs
// Rust BTreeSet::Range::size_hint testing
use std::collections::btree_set::*;
fn main() {
let mut treeset = BTreeSet::<u32>::new();
for i in 0..78 {
if i % 3 != 1 {
treeset.insert(i);
View aExperiment.md

SPARQL End point benchmark, episode 3

Former experiments

This one

In this gist, we benchmark Wasm Tree Store on SPARQL request using the Comunica engine. We compare it to the default parameters of Comunica, which resorts to a n3 store.

@BruJu
BruJu / VecOrDataset.rs
Last active Jul 8, 2020
VecOrMoreComplexDataset
View VecOrDataset.rs
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// Current status : It works
// SophiaExportQuad : https://github.com/BruJu/Portable-Reasoning-in-Web-Assembly/blob/bf9aefade845c9a9b15e8ba6196d33b42ea5701d/sophia-wasm/src/datamodel_quad.rs#L78
///////////////////////////////////////////////////
///////////////////////////////////////////////////
View Destructor.js
// Not yet tested because WeakRef isn't supported on my browsers
// Actually that's bad because Destructors will exist :
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
class Destructor {
constructor(object, destructor, time) {
this.object = new WeakRef(object);
this.destructor = destructor;
@BruJu
BruJu / forEachEval.py
Last active Dec 4, 2020
forEachEvaluation
View forEachEval.py
import json
import numpy
with open('forEachEval.json') as json_file:
data = json.load(json_file)
def avg(l):
s = sum(l)
return s / len(l)