gpuFilterStats = {
let count = 0;
const gpu = new GPU.GPU({ mode: 'webgl2' });
const predicate = gpu.createKernel(function(proto, startPort, endPort, isActive) {
if (
proto[this.thread.x] === 6 &&
(startPort[this.thread.x] > 0 && endPort[this.thread.x] < 200 || startPort[this.thread.x] === 49152) &&
isActive[this.thread.x] === 1
) {
return 1;
}
return 0;
}).setOutput([policies.length]);
const t1 = performance.now();
const result = predicate(protos, startPorts, endPorts, isActives);
const t2 = performance.now();
return {
result: result,
count: d3.sum(result),
ms: t2 - t1
};
}