{"action":"created","issue":{"url":"https://api.github.com/repos/iojs/io.js/issues/1361","labels_url":"https://api.github.com/repos/iojs/io.js/issues/1361/labels{/name}","comments_url":"https://api.github.com/repos/iojs/io.js/issues/1361/comments","events_url":"https://api.github.com/repos/iojs/io.js/issues/1361/events","html_url":"https://github.com/iojs/io.js/pull/1361","id":66785616,"number":1361,"title":"zlib: make constants keep readonly","user":{"login":"JacksonTian","id":327019,"avatar_url":"https://avatars.githubusercontent.com/u/327019?v=3","gravatar_id":"","url":"https://api.github.com/users/JacksonTian","html_url":"https://github.com/JacksonTian","followers_url":"https://api.github.com/users/JacksonTian/followers","following_url":"https://api.github.com/users/JacksonTian/following{/other_user}","gists_url":"https://api.github.com/users/JacksonTian/gists{/gist_id}","starred_url":"https://api.github.com/users/JacksonTian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacksonTian/subscriptions","organizations_url":"https://api.github.com/users/JacksonTian/orgs","repos_url":"https://api.github.com/users/JacksonTian/repos","events_url":"https://api.github.com/users/JacksonTian/events{/privacy}","received_events_url":"https://api.github.com/users/JacksonTian/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/iojs/io.js/labels/zlib","name":"zlib","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-04-07T06:00:36Z","updated_at":"2015-04-08T13:15:09Z","closed_at":"2015-04-07T15:08:05Z","pull_request":{"url":"https://api.github.com/repos/iojs/io.js/pulls/1361","html_url":"https://github.com/iojs/io.js/pull/1361","diff_url":"https://github.com/iojs/io.js/pull/1361.diff","patch_url":"https://github.com/iojs/io.js/pull/1361.patch"},"body":"In zlib module, a dozen constants were exported to user land,\r\nIf user change the constant, maybe lead unexcepted error.\r\n\r\nMake them readonly and freezon."},"comment":{"url":"https://api.github.com/repos/iojs/io.js/issues/comments/90911416","html_url":"https://github.com/iojs/io.js/pull/1361#issuecomment-90911416","issue_url":"https://api.github.com/repos/iojs/io.js/issues/1361","id":90911416,"user":{"login":"shigeki","id":782880,"avatar_url":"https://avatars.githubusercontent.com/u/782880?v=3","gravatar_id":"","url":"https://api.github.com/users/shigeki","html_url":"https://github.com/shigeki","followers_url":"https://api.github.com/users/shigeki/followers","following_url":"https://api.github.com/users/shigeki/following{/other_user}","gists_url":"https://api.github.com/users/shigeki/gists{/gist_id}","starred_url":"https://api.github.com/users/shigeki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shigeki/subscriptions","organizations_url":"https://api.github.com/users/shigeki/orgs","repos_url":"https://api.github.com/users/shigeki/repos","events_url":"https://api.github.com/users/shigeki/events{/privacy}","received_events_url":"https://api.github.com/users/shigeki/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T13:15:09Z","updated_at":"2015-04-08T13:15:09Z","body":"@trevnorris Wow, I did not realize that  the forEach has so much performance degradation. Thanks.\r\n\r\nA new benchmark shows about 11% performance loss in lookup with this commit. I can't decide if it is serious.\r\n\r\n```sh\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 625939.69392\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 669428.59785\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 661328.00027\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 656103.20345\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 632819.48158\r\n\r\nave. 649123.795414\r\n\r\nReverted\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 702057.08514\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 755169.90155\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 742403.59253\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 745905.08977\r\nohtsu@ubuntu:~/github/io.js$ ./iojs ./benchmark/zlib/zlib_lookup.js\r\nzlib/zlib_lookup.js n=2000000: 693043.52458\r\n\r\nave. 727715.838714\r\n\r\n649123.795414/727715.838714=0.89200174145050111799867436958126\r\n```\r\n\r\n```diff\r\n--- a/benchmark/zlib/zlib_lookup.js\r\n+++ b/benchmark/zlib/zlib_lookup.js\r\n@@ -29,9 +29,10 @@ function main(conf) {\r\n\r\n   bench.start();\r\n   for (var i = 0; i < n; i += 1) {\r\n-    Object.keys(zlib.codes).forEach(function(key) {\r\n-      assert.equal(zlib.codes[key], zlib_codes[key]);\r\n-    });\r\n+    var keys = Object.keys(zlib.codes);\r\n+    for(var j = 0; j < keys.length; ++j) {\r\n+      assert.equal(zlib.codes[keys[j]], zlib_codes[keys[j]]);\r\n+    };\r\n   }\r\n   bench.end(n);\r\n }\r\n````"}}