Skip to content

Instantly share code, notes, and snippets.

@atg
atg / nosqlite.js
Last active October 8, 2018 14:55
const sqlite = require('sqlite');
const msgpack = require('msgpack-lite');
const fs = require('fs');
const pathlib = require('path');
const zoneToFilename = (zone) => zone.replace(/[^\p{L}\p{N}_\-]+/gu, '') || '_';
const separator = '\x1f';
const mangle = (key) => {
if (typeof key === 'string') return key + separator;
else return key.join(separator) + separator;
};
let msgpackLite = require('msgpack-lite');
let borc = require('borc');
let _ = require('lodash');
let { performance } = require('perf_hooks')
let arrays = _.times(100, (n) => {
return _.times(n, i => _.random(10000, 99999, false))
});
let encodedBORC = arrays.map(array => borc.encode(array));
(function () {
var array1, array2, array3, array4, gen, y, x;
array1 = [50, 30, 70, 20];
var obj = {
idx: 0,
next: function() {
if (obj.idx >= array1.length) {
return { done: true };
}
(function () {
var array1, array2, array3, array4, gen, iterator, x;
array1 = [50, 30, 70, 20];
gen = function*() {
return (yield* array1);
};
array2 = [];
array3 = [];
array4 = [];
iterator = gen();
/*
on my machine:
es3 50000095000000 1085 ms
es5 50000095000000 11037 ms
es6 50000095000000 910 ms
es3 50000095000000 1100 ms
es5 50000095000000 11640 ms
es6 50000095000000 876 ms
*/
a-̧̀ŝ̖ü͈p̩̥̿̾ề̫̻ŕ͈̪́i̡̩̔̀ó̪̙̅r̛͕̭̈́-̣̮̯̼̤̱̗͗̆̍̿͛̕̕̚͘͜͜c͚̼͉̠͚̘͚̍͗̐̈́̾̑͜͜͠͝͠u̫͙̤̥͖̠̻̲͓͊̌̓̂̎̉̉̓͝ĺ̛̠̘͉̠̩̬̝̰̣̔̆̇̓̒̑̉t̜̼͍͉̜̙̤̫͊̅̎́͂͛̄̑͝ͅ-
~~ bool ~~
bool#type(object) -> the object's type
bool#str(object='') -> str
bool#from_bytes(bytes, byteorder, *, signed=False) -> int
bool#to_bytes(length, byteorder, *, signed=False) -> bytes
~~ bytearray ~~
bytearray#type(object) -> the object's type
bytearray#str(object='') -> str
bytearray#center(width[, fillchar]) -> copy of B
bytearray#count(sub[, start[, end]]) -> int
~~ bool ~~
bool#type(object) -> the object's type
bool#str(object='') -> str
bool#from_bytes(bytes, byteorder, *, signed=False) -> int
bool#to_bytes(length, byteorder, *, signed=False) -> bytes
~~ bytearray ~~
bytearray#type(object) -> the object's type
bytearray#str(object='') -> str
bytearray#center(width[, fillchar]) -> copy of B
bytearray#count(sub[, start[, end]]) -> int
_ = require 'lodash'
{Tokenizer} = require './tokenize'
last = _.last
# There's two varieties of data structures: 'vals' and 'val'
# 'vals' is a branch node that contains many direct children
# 'val' is a leaf node that has no direct children
makeVals = (kind, vals) -> { kind: kind, vals: vals }
@atg
atg / crashes.txt
Created February 16, 2016 01:38
crashes in 3.2.3
=~- Happened 7 times -~=
========================
== e748173eb77c76cfcb1c983070ac
--
objc_retain
=~- Happened 6 times -~=
========================
== bf90131940ccdc80edc3e54e26ef