RESOLVED FIXED 3965
IndexToNameMap::IndexToNameMap has n-squared behavior
https://bugs.webkit.org/show_bug.cgi?id=3965
Summary IndexToNameMap::IndexToNameMap has n-squared behavior
Geoffrey Garen
Reported 2005-07-12 11:12:47 PDT
For each argument, it searches through each argument to check for duplicate parameter names. A better solution would move FunctionImp::getParameterName into IndexToNameMap::IndexToNameMap, and use a hash table to keep track of already seen parameter names --> better modularity and O(1) behavior.
Attachments
Sample SunSpider test (3.29 KB, text/javascript)
2008-03-30 15:36 PDT, David Kilzer (:ddkilzer)
no flags
Script to generate function args test suite (568 bytes, text/plain)
2008-04-06 11:52 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2008-03-30 15:36:52 PDT
Created attachment 20224 [details] Sample SunSpider test SunSpider-0.9 doesn't use the "arguments" object from within a function, so it can't be used to test the performance of the IndexToNameMap constructor code. This is a test that may be dropped into the SunSpider directory to be run. I'm sure it doesn't mimic any real-world usage of arguments, but it does exercise the code in the IndexToNameMap constructor.
David Kilzer (:ddkilzer)
Comment 2 2008-04-06 11:52:28 PDT
Created attachment 20370 [details] Script to generate function args test suite This script generates tests for use with SunSpider. It tests passing 0 to 10 arguments to eleven different functions, each of which have 0 to 10 arguments, for a total of 121 tests. The script should be run from the checked-out SunSpider directory, and generates files of the form: function-args-M-N.js where "M" is the number arguments the function is defined with and N is the number of arguments actually passed to that function. Note that the script outputs a list of function names to stdout, which need to be added to tests/LIST before running SunSpider: $ ./sunspider --shell ../WebKitBuild/Release/testkjs --tests function-args --run 25
David Kilzer (:ddkilzer)
Comment 3 2008-09-21 18:50:00 PDT
Darin Adler
Comment 4 2008-09-21 19:32:30 PDT
I eliminated IndexToNameMap in http://trac.webkit.org/changeset/36743 and I believe this bug is fixed now.
David Kilzer (:ddkilzer)
Comment 5 2008-09-21 23:15:58 PDT
(In reply to comment #4) > I eliminated IndexToNameMap in http://trac.webkit.org/changeset/36743 and I > believe this bug is fixed now. See Bug 20972.
Note You need to log in before you can comment on or make changes to this bug.