How to use the marky.stop function in marky

To help you get started, we’ve selected a few marky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github isomorphic-git / isomorphic-git / src / models / GitPackIndex.js View on Github external
for (let i = 0; i < size; i++) {
      const hash = reader.slice(20).toString('hex')
      hashes[i] = hash
    }
    log(`hashes ${marky.stop('hashes').duration}`)
    reader.seek(reader.tell() + 4 * size)
    // Skip over CRCs
    marky.mark('offsets')
    // Get offsets
    const offsets = new Map()
    for (let i = 0; i < size; i++) {
      offsets.set(hashes[i], reader.readUInt32BE())
    }
    log(`offsets ${marky.stop('offsets').duration}`)
    const packfileSha = reader.slice(20).toString('hex')
    log(`fromIdx ${marky.stop('fromIdx').duration}`)
    return new GitPackIndex({
      hashes,
      crcs: {},
      offsets,
      packfileSha,
      getExternalRefDelta
    })
  }
github nolanlawson / pokedex.org / src / js / client / main / detailViewOrchestrator.js View on Github external
function computeTransformsPartTwo(nationalId, outAnimation) {
  marky.mark('computeTransformsPartTwo()');

  // reeeaaally fling it away when animating out. looks better
  var slideInY = outAnimation ? screenHeight * 1.1 : screenHeight * 0.6;

  var fgTransform = `translateY(${slideInY}px)`;

  marky.stop('computeTransformsPartTwo()');

  return {
    fgTransform
  };
}
github pouchdb / pouchdb / tests / performance / perf.reporter.js View on Github external
exports.endIteration = function (testCase) {
  var entry = marky.stop(testCase.name);
  results.tests[testCase.name].iterations.push(entry.duration);
};
github loehnertz / Tanglestash / app / tanglestash.js View on Github external
this.failedChunks.splice(failedChunkIndex, 1);
            }

            let trytesMessage = this.iota.utils.toTrytes(JSON.stringify({[this.ChunkContentKey]: chunk["content"]}));
            let address = await this.getNewIotaAddress();
            let transaction = await this.sendTransaction(address, trytesMessage);

            Marky.stop('saveToTangle');

            chunk["hash"] = transaction["hash"];
            chunk["persisted"] = true;
            this.chunkBundle[chunk["index"]] = chunk;
            this.successfulChunks += 1;
            return true;
        } catch (err) {
            Marky.stop('saveToTangle');

            if (this.failedChunks.indexOf(chunk["index"]) === -1) {
                this.failedChunks.push(chunk["index"]);
            }

            console.warn(err.message, chunk);
        }
    }
github loehnertz / Tanglestash / app / tanglestash.js View on Github external
async persistChunk(chunk) {
        Marky.mark('saveToTangle');

        try {
            let failedChunkIndex = this.failedChunks.indexOf(chunk["index"]);
            if (failedChunkIndex !== -1) {
                this.failedChunks.splice(failedChunkIndex, 1);
            }

            let trytesMessage = this.iota.utils.toTrytes(JSON.stringify({[this.ChunkContentKey]: chunk["content"]}));
            let address = await this.getNewIotaAddress();
            let transaction = await this.sendTransaction(address, trytesMessage);

            Marky.stop('saveToTangle');

            chunk["hash"] = transaction["hash"];
            chunk["persisted"] = true;
            this.chunkBundle[chunk["index"]] = chunk;
            this.successfulChunks += 1;
            return true;
        } catch (err) {
            Marky.stop('saveToTangle');

            if (this.failedChunks.indexOf(chunk["index"]) === -1) {
                this.failedChunks.push(chunk["index"]);
            }

            console.warn(err.message, chunk);
        }
    }
github djfdyuruiry / ts-lambda-api / src / util / timed.ts View on Github external
descriptor.value = async function(this: void, ...args: any[]) {
        if (ProfilingEnabled) {
            mark(propertyKey)
        }

        let result = await functionToMeasure.apply(this, args)

        if (ProfilingEnabled) {
            let measurement = stop(propertyKey)

            console.log(`method '${measurement.name}' took ${measurement.duration.toFixed(2)} ms`)
        }

        return result
    }
}
github nolanlawson / pokedex.org / src / js / client / main / scrollingList.js View on Github external
function doApplyPatch(patchString) {
  marky.mark('JSON.parse()');
  var patch = JSON.parse(patchString);
  marky.stop('JSON.parse()');
  marky.mark('patchElement()');
  applyPatch(monstersList, patch);
  marky.stop('patchElement()');
  progress.end();
}
github isomorphic-git / isomorphic-git / src / models / GitPackIndex.js View on Github external
const oid = await shasum(GitObject.wrap({ type, object }))
        times.hash += marky.stop('hash').duration
        o.oid = oid
        hashes.push(oid)
        offsets.set(oid, offset)
        crcs[oid] = o.crc
      } catch (err) {
        log('ERROR', err)
        continue
      }
    }

    marky.mark('sort')
    hashes.sort()
    times['sort'] = Math.floor(marky.stop('sort').duration)
    const totalElapsedTime = marky.stop('total').duration
    times.hash = Math.floor(times.hash)
    times.readSlice = Math.floor(times.readSlice)
    times.misc = Math.floor(
      Object.values(times).reduce((a, b) => a - b, totalElapsedTime)
    )
    log(Object.keys(times).join('\t'))
    log(Object.values(times).join('\t'))
    log('by depth:')
    log([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].join('\t'))
    log(objectsByDepth.slice(0, 12).join('\t'))
    log(
      timeByDepth
        .map(Math.floor)
        .slice(0, 12)
        .join('\t')
    )
github nolanlawson / pokedex.org / src / js / client / main / detailViewOrchestrator.js View on Github external
var sourceSpriteRect = sourceSprite.getBoundingClientRect();
  var detailSpriteRect = getDetailSpriteRect();
  var sourceTitleSpanHeight = getSpanHeight(sourceTitleSpan);

  var spriteChangeX = sourceSpriteRect.left - detailSpriteRect.left;
  var spriteChangeY = sourceSpriteRect.top - detailSpriteRect.top;

  var scaleX = sourceSpriteRect.width / screenWidth;
  var scaleY = (sourceSpriteRect.height - sourceTitleSpanHeight) / screenHeight;
  var toX = sourceSpriteRect.left;
  var toY = sourceSpriteRect.top;

  var bgTransform = `translate(${toX}px,${toY}px) scale(${scaleX},${scaleY})`;
  var spriteTransform = `translate(${spriteChangeX}px, ${spriteChangeY}px)`;

  marky.stop('computeTransformsPartOne()');

  return {
    bgTransform,
    spriteTransform,
    spriteTop: detailSpriteRect.top + getScrollTop(),
    spriteLeft: detailSpriteRect.left
  };
}
github necolas / react-native-web / packages / benchmarks / src / benchmark.js View on Github external
const measure = (name, fn) => {
  marky.mark(name);
  fn();
  const performanceMeasure = marky.stop(name);
  return performanceMeasure.duration;
};

marky

Performance timer based on performance.mark() and measure()

Apache-2.0
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis