Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@shelf/fast-chunk-string
Advanced tools
Readme
Chunk string into equal substrings with unicode support
Credits to stackoverflow.com/a/29202760/2727317
$ yarn add @shelf/fast-chunk-string
const fastChunkString = require('@shelf/fast-chunk-string');
// the fastest way
fastChunkString('unicorns', {size: 2, unicodeAware: false});
// => ['un', 'ic', 'or', 'ns']
// ignore unicode, still fast but inaccurate
fastChunkString('😀😃😄😁', {size: 2, unicodeAware: false});
// => ['😀', '😃', '😄', '😁']
// respect unicode, slow but accurate
fastChunkString('😀😃😄😁', {size: 2, unicodeAware: true});
// => ['😀😃', '😄😁']
Run via yarn benchmark
. Measured on Macbook Pro 16" with M1 Max processor.
Running "Without Unicode" suite...
Progress: 100%
~33 kb split by 2 kb:
14 384 027 ops/s, ±0.21% | 86.51% slower
~33 kb split by 1 mb:
106 655 332 ops/s, ±0.12% | fastest
~330 kb split by 2 kb:
1 482 220 ops/s, ±0.34% | 98.61% slower
~330 kb split by 1 mb:
106 442 883 ops/s, ±0.14% | 0.2% slower
~3.3 mb split by 2 kb:
153 356 ops/s, ±0.19% | 99.86% slower
~3.3 mb split by 1 mb:
48 824 019 ops/s, ±0.16% | 54.22% slower
~33 mb split by 2 kb:
14 312 ops/s, ±0.28% | slowest, 99.99% slower
~33 mb split by 1 mb:
7 059 008 ops/s, ±0.32% | 93.38% slower
Finished 8 cases!
Fastest: ~33 kb split by 1 mb
Slowest: ~33 mb split by 2 kb
Running "Unicode Aware" suite...
Progress: 100%
~33 kb split by 2 kb with unicodeAware:
450 ops/s, ±0.24% | fastest
~33 kb split by 1 mb with unicodeAware:
428 ops/s, ±0.36% | 4.89% slower
~330 kb split by 2 kb with unicodeAware:
45 ops/s, ±0.38% | 90% slower
~330 kb split by 1 mb with unicodeAware:
41 ops/s, ±0.42% | slowest, 90.89% slower
Finished 4 cases!
Fastest: ~33 kb split by 2 kb with unicodeAware
Slowest: ~330 kb split by 1 mb with unicodeAware
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
MIT © Shelf
FAQs
Chunk string into equal substrings with unicode support
We found that @shelf/fast-chunk-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 56 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).