RESOLVED FIXED 157297
Web Inspector: console.assert should do far less work when the assertion is true
https://bugs.webkit.org/show_bug.cgi?id=157297
Summary Web Inspector: console.assert should do far less work when the assertion is true
Joseph Pecoraro
Reported 2016-05-02 20:50:36 PDT
* SUMMARY console.assert should do far less work when the assertion is true. * TEST <script> (function() { function bench(name, f, arg) { var warmup = f(); var start = Date.now(); var result = f(); var end = Date.now(); console.log(name, (end-start)+"ms"); } bench("console.assert...", function() { for (var i = 0; i < 1e6; ++i) console.assert(true, "message"); }); })(); </script> * RESULTS • Safari - console.assert... – "119ms" • Chrome - console.assert... 22ms • Firefox - console.assert... 44ms We do a lot of work in the case where the assert doesn't fire. After a quick fix: • Safari - console.assert... – "9ms"
Attachments
[PATCH] Proposed Fix (3.62 KB, patch)
2016-05-02 20:55 PDT, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2016-05-02 20:52:01 PDT
Joseph Pecoraro
Comment 2 2016-05-02 20:55:19 PDT
Created attachment 277972 [details] [PATCH] Proposed Fix We could make assert an intrinsic in the future, but I'm not sure it really needs it. This alone was a 10x speedup.
Timothy Hatcher
Comment 3 2016-05-02 21:52:29 PDT
Comment on attachment 277972 [details] [PATCH] Proposed Fix Nice!
WebKit Commit Bot
Comment 4 2016-05-03 08:24:00 PDT
Comment on attachment 277972 [details] [PATCH] Proposed Fix Clearing flags on attachment: 277972 Committed r200371: <http://trac.webkit.org/changeset/200371>
WebKit Commit Bot
Comment 5 2016-05-03 08:24:05 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 6 2016-05-03 08:32:36 PDT
Comment on attachment 277972 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=277972&action=review > Source/JavaScriptCore/runtime/ConsoleClient.h:53 > + void assertion(ExecState*, RefPtr<Inspector::ScriptArguments>&&); The right name for this seems to be "assertionFailed". Longer term, really puzzled about the fact that ScriptArguments is a reference counted object.
Note You need to log in before you can comment on or make changes to this bug.