Skip to content

Instantly share code, notes, and snippets.

View BruJu's full-sized avatar
🐓

Julian Bruyat BruJu

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

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 June 5, 2020 13:18
TreedDataset - new with same indexes
// 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 July 2, 2020 05:46
Benchmarking RDF JS Stores with Comunica SPARQL Engine using the BSBM benchmark

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 June 23, 2020 16:36
Detective Pikaptcha
// https://www.codingame.com/ide/puzzle/detective-pikaptcha-ep2
#include <iostream>
#include <vector>
#include <optional>
enum class Direction {
TOP, BOT, LEFT, RIGHT
};
@BruJu
BruJu / pinkinvisibleunicorn.rs
Created July 1, 2020 11:30
Rust BTreeSet::Range::size_hint testing
// 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);

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 July 8, 2020 16:22
VecOrMoreComplexDataset
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// Current status : It works
// SophiaExportQuad : https://github.com/BruJu/Portable-Reasoning-in-Web-Assembly/blob/bf9aefade845c9a9b15e8ba6196d33b42ea5701d/sophia-wasm/src/datamodel_quad.rs#L78
///////////////////////////////////////////////////
///////////////////////////////////////////////////
@BruJu
BruJu / Destructor.js
Last active July 9, 2020 16:58
Destructor
// 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 December 4, 2020 02:52
forEachEvaluation
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)