Permalink
Browse files

Extend name mangling from base54 to base64 after first character. Pro…

…vides better compression on libraries with a large number of variables.

Example: DynarchLib compresses 571 bytes smaller (non-gzipped) or 212 bytes smaller (gzipped).
  • Loading branch information...
1 parent cc8bdc3 commit 5b2c91be0c63777e759c9baa6aa927fd56b4346c @neonux neonux committed Jan 23, 2011
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/process.js
View
@@ -273,13 +273,14 @@ function Scope(parent) {
};
var base54 = (function(){
- var DIGITS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_";
+ var DIGITS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
return function(num) {
- var ret = "";
- do {
- ret = DIGITS.charAt(num % 54) + ret;
- num = Math.floor(num / 54);
- } while (num > 0);
+ var ret = DIGITS.charAt(num % 54);
+ num = Math.floor(num / 54);
+ while (num > 0) {
+ ret += DIGITS.charAt(num % 64);
+ num = Math.floor(num / 64);
+ }
return ret;
};
})();

0 comments on commit 5b2c91b

Please sign in to comment.