eclipse / paho.mqtt.javascript

paho.mqtt.javascript
Other
1.15k stars 467 forks source link

Refactored Properties using Object.defineProperties #120

Closed tmulkern closed 7 years ago

tmulkern commented 7 years ago

Refactored Properties using Object.defineProperties as seen here

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

This reduces the javascript code by removing repeated code. This will have an impact on overall file size.

Signed-off-by: Tadhg Mulkerntadhg.j.mulkern@gmail.com

tmulkern commented 7 years ago

Size before changes

[INFO] Uncompressed size: 91402 bytes.
[INFO] Compressed size: 33401 bytes minified (8429 bytes gzipped).

https://travis-ci.org/eclipse/paho.mqtt.javascript/builds/272407632#L765

Size after changes

[INFO] Uncompressed size: 89225 bytes.
[INFO] Compressed size: 31502 bytes minified (8078 bytes gzipped).

https://travis-ci.org/eclipse/paho.mqtt.javascript/builds/273000617#L773

That's a saving of 2% Uncompressed, 6% Compressed and 4% gzipped

jpwsutton commented 7 years ago

Thanks @tmulkern, nice improvement!