Skip to content

Commit f2411ad

Browse files
committed
bitwise dimens hash v str for +~50x perf on checks
1 parent 7a4cfcd commit f2411ad

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,13 @@ function triggerResizeListener(listener, vpWidth, vpHeight) {
7878
if(!hasher) {
7979
switch (options?.dimension) {
8080
case 'w':
81-
hash = `${vpWidth}`;
81+
hash = vpWidth;
8282
break;
8383
case 'h':
84-
hash = `${vpHeight}`;
84+
hash = vpHeight;
8585
break;
8686
default:
87-
case 'both':
88-
hash = `${vpWidth}_${vpHeight}`;
87+
hash = (vpWidth << 16) | vpHeight;
8988
break;
9089
}
9190
}

0 commit comments

Comments
 (0)