In JSMin:
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 17 Sep 2010 07:59:39 +0000 (07:59 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 17 Sep 2010 07:59:39 +0000 (07:59 +0000)
commit2e4620e952ff6c281c002fa28107276b77ede28c
treefed3d1ed952b37bbad5c9189708462e7d03dd3ca
parente72484da8995c0e028e396711516c16493b8be8a
In JSMin:
* Don't delete line breaks, it's annoying. Replace multi-line comments with the same number of line breaks, to keep line numbers the same. Tested line break count for jquery.js, it's the same now with or without minification.
* Remove the line break from the start of the output, which is there due to $this->a being initialised to "\n".
* Simplified get() by moving the character translations to __construct(). This enables some useful optimisations.
* Straightened out lookAhead/peek logic, which was poorly ported from C, where it was simulated using getc(stdin).
* Optimised scanning for end of comment, using strcspn() and strpos(). Now does multi-line comments at 14700 KB/s instead of 200 KB/s. Same trick with string and regex literals.
* For clarity, don't use $this->a as a temporary variable in the DELETE_A branch of action(). The only way the loop can exit is by it being the same as $this->b, which it was to start with anyway, so there's no point changing it in every iteration.
* Inlined get() and peek() into next() for a small performance gain. Removed peek() since it is no longer used.
* Overall, time to minify jquery.js reduced from 1.6s to 0.9s.
includes/libs/JSMin.php