{"action":"opened","issue":{"url":"https://api.github.com/repos/joyent/node-verror/issues/63","repository_url":"https://api.github.com/repos/joyent/node-verror","labels_url":"https://api.github.com/repos/joyent/node-verror/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/joyent/node-verror/issues/63/comments","events_url":"https://api.github.com/repos/joyent/node-verror/issues/63/events","html_url":"https://github.com/joyent/node-verror/issues/63","id":395361519,"node_id":"MDU6SXNzdWUzOTUzNjE1MTk=","number":63,"title":"Do not call sprintf with one argument","user":{"login":"hekike","id":1764512,"node_id":"MDQ6VXNlcjE3NjQ1MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1764512?v=4","gravatar_id":"","url":"https://api.github.com/users/hekike","html_url":"https://github.com/hekike","followers_url":"https://api.github.com/users/hekike/followers","following_url":"https://api.github.com/users/hekike/following{/other_user}","gists_url":"https://api.github.com/users/hekike/gists{/gist_id}","starred_url":"https://api.github.com/users/hekike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hekike/subscriptions","organizations_url":"https://api.github.com/users/hekike/orgs","repos_url":"https://api.github.com/users/hekike/repos","events_url":"https://api.github.com/users/hekike/events{/privacy}","received_events_url":"https://api.github.com/users/hekike/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-02T19:57:45Z","updated_at":"2019-01-02T19:57:45Z","closed_at":null,"author_association":"NONE","body":"*Safe user inputs in messages*\r\n\r\nAddresses issue when someone builds message manually and it contains user-input with formatting characters instead `sprintf`.  \r\n\r\nFor example:\r\n```js\r\nvar myInput = \"encoded%stext\"\r\nnew VError(myInput + \" invalid input\")\r\n```\r\n\r\nRelated to https://github.com/joyent/node-verror/issues/57\r\n\r\n*Performance Improvement*\r\n\r\nCalling `sprintf` is expensive, do not call when zero arguments are passed.\r\nIn some scenarios, an application needs to create hundreds of VError(s).\r\n\r\nTo test the change's effect:\r\n\r\n```\r\nfor(var i = 0; i < 10000; i++) {\r\n        new mod_verror.VError('Foo')\r\n}\r\n```\r\n\r\nOn my 2017 MBP 3.5Ghz, I see a 27% performance improvement after the change.\r\n\r\nBefore:\r\n![screen shot 2018-12-31 at 10 29 47 am](https://user-images.githubusercontent.com/1764512/50565766-07d6b100-0ce7-11e9-9e6e-fcbd6cc5d7dd.png)\r\n"}}
{"actor":{"display_login":"hekike"}}