All Projects → discord → Fastglobal

discord / Fastglobal

Licence: mit
Fast no copy globals for Elixir & Erlang.

Programming Languages

elixir
2628 projects
erlang
1774 projects

Projects that are alternatives of or similar to Fastglobal

Haul Vs Reactnative
Testing the performance between React Native and Haul Packagers
Stars: ✭ 22 (-97.51%)
Mutual labels:  performance
Wordpress Rest Cache
WordPress Plugin to lazy cache HTTP requests in database and update via cron.
Stars: ✭ 8 (-99.09%)
Mutual labels:  performance
Stats Js
JavaScript Performance Monitor using canvas
Stars: ✭ 12 (-98.64%)
Mutual labels:  performance
Listpool
Optimized allocation free implementation of IList using ArrayPool.
Stars: ✭ 25 (-97.17%)
Mutual labels:  performance
Performance
In diesem Repository befinden sich Projekte rund um das Thema Performanz.
Stars: ✭ 7 (-99.21%)
Mutual labels:  performance
Lozad.js
🔥 Highly performant, light ~1kb and configurable lazy loader in pure JS with no dependencies for responsive images, iframes and more
Stars: ✭ 6,932 (+685.94%)
Mutual labels:  performance
Node Servertiming
📊 Generate Server-Timing headers interactively in NodeJS
Stars: ✭ 19 (-97.85%)
Mutual labels:  performance
Clusterize.js
Tiny vanilla JS plugin to display large data sets easily
Stars: ✭ 6,995 (+693.08%)
Mutual labels:  performance
Sequelize Benchmark
Benchmarks for sequelize
Stars: ✭ 8 (-99.09%)
Mutual labels:  performance
Active record doctor
Identify database issues before they hit production.
Stars: ✭ 865 (-1.93%)
Mutual labels:  performance
Browser Perf
Performance Metrics for Web Browsers
Stars: ✭ 930 (+5.44%)
Mutual labels:  performance
Stackext
Header-only C++ library for working with an extended stack
Stars: ✭ 27 (-96.94%)
Mutual labels:  performance
V8 Bailout Reasons
🔧 A list of Crankshaft bailout reasons with examples
Stars: ✭ 861 (-2.38%)
Mutual labels:  performance
Go Concurrency Test
Test the performance of Go's concurrency structures
Stars: ✭ 24 (-97.28%)
Mutual labels:  performance
Bench Scripts
A compilation of Linux server benchmarking scripts.
Stars: ✭ 873 (-1.02%)
Mutual labels:  performance
Lazycache
An easy to use thread safe in-memory caching service with a simple developer friendly API for c#
Stars: ✭ 901 (+2.15%)
Mutual labels:  performance
Image Actions
A Github Action that automatically compresses JPEGs, PNGs and WebPs in Pull Requests.
Stars: ✭ 844 (-4.31%)
Mutual labels:  performance
Sysbench Docker Hpe
Sysbench Dockerfiles and Scripts for VM and Container benchmarking MySQL
Stars: ✭ 14 (-98.41%)
Mutual labels:  performance
Laravel Image Optimizer
Optimize images in your Laravel app
Stars: ✭ 873 (-1.02%)
Mutual labels:  performance
Structvsclassperformance
POC for my Medium article
Stars: ✭ 11 (-98.75%)
Mutual labels:  performance

FastGlobal

Master Hex.pm Version

The Erlang VM is great at many things, but quick access to large shared data is not one of them. Storing data in a single process results in overloading the process, using an ETS table gets more expensive to read as the data gets larger, and both require copying data to the calling process. If you have large infrequently changing data that needs to be accessed by thousands of processes there is a better way.

Erlang has an optimization called constant pools for functions that return static data, you can also compile modules at runtime. This method was originally popularized by mochiglobal. This module is an Elixir version with some optimizations such as generating the atom keys and reusing them.

Performance

benchmark name               iterations   average time
fastglobal get                 10000000   0.33 µs/op
ets get                          500000   7.64 µs/op
agent get                        100000   12.67 µs/op
fastglobal purge perf (100)         500   2846.26 µs/op
fastglobal put (5)                  500   3683.30 µs/op
fastglobal put (10)                 500   6449.98 µs/op
fastglobal put (100)                 50   44543.56 µs/op

Caveats

  • Compile times get slower as data size increases.
  • Compile times get slower the more processes are in the system. Erlang talks to each process when purging a module.
  • Getting a key that does not exist is expensive due to try/catch, put at least a nil value.
  • Creating atoms from strings is not cheap, use FastGlobal.new.

Usage

Add it to mix.exs

defp deps do
  [{:fastglobal, "~> 1.0"}]
end

And just use it as a global map.

data = %{
  a: 1,
  b: 2,
  c: [3, 4]
}
FastGlobal.put(:data, data)
data == FastGlobal.get(:data)

License

FastGlobal is released under the MIT License. Check LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].