From 38b43cef812abea5bf4317421fbf5d06fb91176c Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 29 Nov 2018 04:59:50 +0300 Subject: [PATCH] experimenting with v8-compile-cache -- buggy... Signed-off-by: Alex A. Naanou --- ui (gen4)/e.js | 2 ++ ui (gen4)/ig.js | 2 ++ ui (gen4)/imagegrid/tags.js | 23 +++++++++++++++++++++++ ui (gen4)/lib/util.js | 13 +++++++++++++ ui (gen4)/ui.js | 2 ++ 5 files changed, 42 insertions(+) diff --git a/ui (gen4)/e.js b/ui (gen4)/e.js index 75b5c2da..ad9c0443 100644 --- a/ui (gen4)/e.js +++ b/ui (gen4)/e.js @@ -6,6 +6,8 @@ * **********************************************************************/ +//require('v8-compile-cache') + var electron = require('electron') var app = electron.app var BrowserWindow = electron.BrowserWindow diff --git a/ui (gen4)/ig.js b/ui (gen4)/ig.js index 38e659e4..df6f8dd8 100755 --- a/ui (gen4)/ig.js +++ b/ui (gen4)/ig.js @@ -8,6 +8,8 @@ //var DEBUG = DEBUG != null ? DEBUG : true +//require('v8-compile-cache') + require('./cfg/requirejs') nodeRequire = diff --git a/ui (gen4)/imagegrid/tags.js b/ui (gen4)/imagegrid/tags.js index 631450f3..d878ea44 100755 --- a/ui (gen4)/imagegrid/tags.js +++ b/ui (gen4)/imagegrid/tags.js @@ -25,6 +25,29 @@ var util = require('lib/util') +/*********************************************************************/ + +// XXX a Set-like back-end... +// API: +// .has(..) +// -> bool +// +// Unite two sets... +// .unite(..) +// -> new +// +// Intersection of two sets... +// .intersect(..) +// -> new +// +// Difference of two sets... +// .subtract(..) +// -> new + +// extend Set to support the needed basics... + + + /*********************************************************************/ var TagsClassPrototype = { diff --git a/ui (gen4)/lib/util.js b/ui (gen4)/lib/util.js index 5cc29d8e..a98a9452 100755 --- a/ui (gen4)/lib/util.js +++ b/ui (gen4)/lib/util.js @@ -214,6 +214,19 @@ Array.prototype.sortAs = function(other){ } +// Set set operation shorthands... +Set.prototype.unite = function(other){ + return new Set([...this, ...other]) } +Set.prototype.intersect = function(other){ + var test = other.has ? 'has' : 'includes' + return new Set([...this] + .filter(function(e){ return other[test](e) })) } +Set.prototype.subtract = function(other){ + var test = other.has ? 'has' : 'includes' + return new Set([...this] + .filter(function(e){ return !other[test](e) })) } + + module.chainCmp = function(cmp_chain){ return function(a, b, get, data){ var res diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 242110d9..a8a060c0 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -20,6 +20,8 @@ if((typeof(process) != 'undefined' ? process : {}).__nwjs){ // // NOTE: no need to do this in browser... if(typeof(process) != 'undefined'){ + //require('v8-compile-cache') + requirejs = global.requirejs = window.requirejs =