From 8304993481f4611b64c92aa165938e0107351f96 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Mon, 21 Nov 2022 21:59:08 +0100 Subject: [PATCH] fix: #194 --- packages/core/fraction.mjs | 2 +- packages/core/pattern.mjs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/fraction.mjs b/packages/core/fraction.mjs index d28d051d..3af73e0e 100644 --- a/packages/core/fraction.mjs +++ b/packages/core/fraction.mjs @@ -74,7 +74,7 @@ const fraction = (n) => { -> those farey sequences turn out to make pattern querying ~20 times slower! always use strings! -> still, some optimizations could be done: .mul .div .add .sub calls still use numbers */ - n = String(n); + // n = String(n); // this is actually faster but imprecise... } return Fraction(n); }; diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 2cab88c3..499afd6b 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -800,6 +800,7 @@ export class Pattern { * s(" hh").fast(2) // s("[ hh]*2") */ _fast(factor) { + factor = Fraction(factor); const fastQuery = this.withQueryTime((t) => t.mul(factor)); return fastQuery.withHapTime((t) => t.div(factor)); }