npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

memoryshare-linux-arm64-musl

v1.0.9

Published

`memoryshare` is a module allow Node.js developers share memory between different process

Downloads

12

Readme

Share Memory

memoryshare is a module allow Node.js developers share memory between different process

It's high performance when share data is huge than transfer data by IPC

features

  • High performance ✨
  • Simple api interface 💗
  • Support share string andbuffer data 💗

benchmark

$ yarn bench
Running "data transfer" suite...
Progress: 100%

  ipc:
    26 ops/s, ±96.96%       | slowest, 99.93% slower

  sharString:
    13 686 ops/s, ±72.23%   | 65.29% slower

  shareBuffer:
    39 428 ops/s, ±8.67%   | fastest

Finished 3 cases!
  Fastest: sharebuffer
  Slowest: ipc
✨  Done in 28.89s.

Install

$ npm i memoryshare # or yarn add memoryshare

Support Platform

Note: You need to make sure that the compilation environment of the dynamic library is the same as the installation and runtime environment of the memoryshare call.

  • darwin-x64
  • darwin-arm64
  • linux-x64-gnu
  • win32-x64-msvc
  • win32-ia32-msvc
  • linux-arm64-gnu
  • linux-arm64-musl

How to use

memoryshare support for data that can be serialized as string

Here is an example to guide how to share string data between different process

// main.js
import { fork } from 'child_process'
import { init, setString, getString, clear, setBuffer, getBuffer } from 'memoryshare'

const memId = "string.link"
const bufferMemId = "buffer.link"
clear(memId)
clear(bufferMemId)

init(memId, 4096) // init share memory block with max size,each memId should be called only once
init(bufferMemId, 4096)


function generateBigString() {
  let bigStr = '';
  for (let i = 0; i < 1; i++) {
    bigStr += 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ';
  }
  return bigStr;
}


setString(memId, generateBigString())
setBuffer(bufferMemId, Buffer.from(generateBigString()))
fork('./child')

// child.js
const memId = "string.link"
const data = getString(memId)
const bufferData = getBuffer(bufferMemId)