If your software has a lot of Boolean data representing user prefs or app config, consider using bits to store & transfer: conf = { a: false, b: true, c: true, d: false } As: conf = 6 ie. {a:0, b:1, c:1, d:0} -> 0b0110 (conf >> 3) & 1 //0 (conf >> 2) & 1 //1 ...
-
-
Replying to @rwaldron
Nope, readability matters more. Let the webpack or code transformer do such optimizations.
1 reply 1 retweet 21 likes -
Replying to @nsisodiya @rwaldron
Other devs come to this be likepic.twitter.com/bnGlUSD50N
2 replies 0 retweets 9 likes -
Replying to @StachedAway @nsisodiya
Since when is data supposed to be human readable? You can write a reviver or as
@robpalmer2 suggests: accessors that wrap the bit field in human names on client (Rob linked to this: https://www.reaktor.com/blog/javascript-performance-fundamentals-make-bluebird-fast/ …)1 reply 0 retweets 5 likes -
Replying to @rwaldron @StachedAway and
Code is supposed to be human-readable. `config.a` is infinitely more readable than `(config >> 3) & 1`.
1 reply 0 retweets 2 likes -
Replying to @ArtSolopov @StachedAway and
Code? Yes. Data? Not really? The data I'm talking about is for machines. Write some accessors to expose that data for humans and move on.
1 reply 0 retweets 1 like
Nothing is stopping you from making exactly config.a work. These kinds of wire and memory optimizations have been demonstrably useful for Glimmer and are hidden by accessors even for other internals hackers.
-
-
Do you have some killer comparison data to hand showing the benefit of compressed fields?
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.