All Projects → kb-dev → Sanic.js

kb-dev / Sanic.js

Licence: mit
JS Gotta go fast ! | Increase native JS functions performances

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sanic.js

Easyengine
Command-line control panel for Nginx Server to manage WordPress sites running on Nginx, PHP, MySQL, and Let's Encrypt
Stars: ✭ 1,881 (+3662%)
Mutual labels:  performance, optimization
Tinystr
A small ASCII-only bounded length string representation.
Stars: ✭ 48 (-4%)
Mutual labels:  performance, optimization
Swissarmylib
Collection of helpful utilities we use in our Unity projects.
Stars: ✭ 154 (+208%)
Mutual labels:  performance, optimization
Pg stat kcache
Gather statistics about physical disk access and CPU consumption done by backends.
Stars: ✭ 106 (+112%)
Mutual labels:  performance, optimization
Entitycomponentsystemsamples
No description or website provided.
Stars: ✭ 4,218 (+8336%)
Mutual labels:  performance, native
Ltecleanerfoss
The last Android cleaner you'll ever need!
Stars: ✭ 141 (+182%)
Mutual labels:  performance, optimization
Fe Performance Journey
🚵 a Journey of Performance Optimizing in Frontend 🚀
Stars: ✭ 169 (+238%)
Mutual labels:  performance, optimization
Pc Optimization Hub
collection of various resources devoted to performance and input lag optimization
Stars: ✭ 55 (+10%)
Mutual labels:  performance, optimization
Awesome Wp Speed Up
Plugins and resources to speed up and optimize your WordPress site.
Stars: ✭ 375 (+650%)
Mutual labels:  performance, optimization
Reflective Bind
Eliminate wasteful re-rendering in React components caused by inline functions
Stars: ✭ 366 (+632%)
Mutual labels:  performance, optimization
Go Perfbook
Thoughts on Go performance optimization
Stars: ✭ 9,597 (+19094%)
Mutual labels:  performance, optimization
Chillout
Reduce CPU usage by non-blocking async loop and psychologically speed up in JavaScript
Stars: ✭ 565 (+1030%)
Mutual labels:  performance, optimization
Delta
Programming language focused on performance and productivity
Stars: ✭ 77 (+54%)
Mutual labels:  performance, native
Georaptor
Python Geohash Compression Tool
Stars: ✭ 143 (+186%)
Mutual labels:  performance, optimization
Powa Web
PoWA user interface
Stars: ✭ 66 (+32%)
Mutual labels:  performance, optimization
Router
⚡️ A lightning fast HTTP router
Stars: ✭ 158 (+216%)
Mutual labels:  performance, optimization
Awesome Go Perf
A curated list of Awesome Go performance libraries and tools
Stars: ✭ 223 (+346%)
Mutual labels:  performance, optimization
Camerakit Android
Library for Android Camera 1 and 2 APIs. Massively increase stability and reliability of photo and video capture on all Android devices.
Stars: ✭ 5,131 (+10162%)
Mutual labels:  performance, native
Pydis
A redis clone in Python 3 to disprove some falsehoods about performance.
Stars: ✭ 623 (+1146%)
Mutual labels:  performance, optimization
Tris Webpack Boilerplate
A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
Stars: ✭ 1,016 (+1932%)
Mutual labels:  optimization

sanic.js

Build Status codecov

1.1.0 and here's Object.clone() !

Object.clone() is an optional method you can use on any Object to get a deep clone of this Object. It clones too Array and Date. The function is a bit slow on small objects, so if you have some upgrades ideas, let's talk about it in Issues. :)

Benchmarks between JS classic methods and Sanic methods here.


Another new day in the Javascript's world, and this fucking Array.prototype.map() function is always slow. But Sanic is here to save Javascript from the performance hell. GOTTA GO FAST !

sanic.js is a library which increases Javascript natives functions performance to the detriment of some unused cases of EcmaScript specification. For example, this library removes hasOwnProperty() check in Array methods, because nobody uses Array methods for an Object. (Why am I saying that : See Note 2 of this paragraph).

This project has 2 common uses :

  • like any other library with a classic object with methods.
  • with a special require changing prototype of natives objects concerned (Array, Object, ...) (monkey patching).

gosh you're changing prototype of native objects taht's baaaaaaaad !!!!! :((

The advantage of this bad technic is performances of all library called after sanic.js will be impacted, and using this technic is only one line away :

    require('sanic.js').changeMyWorld();

Due to the danger of the library, there's a lot of unit test and performance tests to try to protect you from bugs. But anyway, there are always bugs, so please report them in Issues section.

Installation

    npm install --save sanic.js

API

Fast use

This mode replaces all prototypes methods by their Sanic equivalents. Sanic methods are written with same parameters than natives prototypes methods. The goal is to give faster functions without any code adaptation.

    require('sanic.js').changeMyWorld();

    const myArray = [1, 2, 3, 5, 8];

    console.log(
        // Yeah, Sanic is activated but there's no code to change
        myArray.reduce((acc, n) => acc + n)
    );

Library use

In this mode, all functions need the object to use to the first parameter and all classic parameters after.

    const Sanic = require('sanic.js').Library;
    const myArray = [1, 2, 3, 5, 8];

    console.log(
        Sanic.Array.reduce(myArray, (acc, n) => acc + n)
    );

Available reworked functions

Array

  • Array.prototype.every()
  • Array.prototype.fill()
  • Array.prototype.find()
  • Array.prototype.filter()
  • Array.prototype.forEach()
  • Array.prototype.map()
  • Array.prototype.reduceRight()
  • Array.prototype.reverse()
  • Array.prototype.some()

Object

  • Object.assign()
  • Object.clone() (optional method)

Performance

    # Run all benchmarks
    npm run benchmark

    # Run specific benchmarks
    npm run benchmark Array.reduce Array.map

    # Method can be set to 'all' to test all methods of a class
    npm run benchmark Array.all

Benchmarks here

Experimental functions

To create this library, I do some bench tests on each function detailed in EcmaScript. But sometimes, natives functions are faster. So I keep my bad functions and I call them experimental functions. That's why there are more functions available in benchmarks than in lib.

If you want to test the performance of these functions (in the case of you want to help this library or others things) :

    # Run all benchmarks
    npm run exp

    # Run specific benchmarks
    npm run exp Array.map Array.indexOf

    # Method can be set to 'all' to test all methods of a class
    npm run exp Array.all

This is the same command line than benchmarks, but it enables a new flag which allows using experimental functions.

Array

  • Array.prototype.concat()
  • Array.prototype.includes()
  • Array.prototype.indexOf()
  • Array.prototype.join()
  • Array.prototype.lastIndexOf()
  • Array.prototype.push()
  • Array.prototype.reduce()
  • Array.prototype.shift()
  • Array.prototype.unshift()

License

MIT (LICENSE)

Thanks to

  • KBDev
  • ProMyze
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].