RESOLVED INVALID 122084
JSArraySetLength optimize jsarray setlength
https://bugs.webkit.org/show_bug.cgi?id=122084
Summary optimize jsarray setlength
Peng Xinchao
Reported 2013-09-29 19:33:54 PDT
JSC Engine Optimize 'var ret =[] ; ret.length=1024' .When type of ret is undefine and it is setted length , its only public length is setted ,but its vector is not setted . the memory of variable ret is not changed .When the type of variable ret is confirm , its will allocate memory by public length.
Attachments
optimze jsarray setlength (8.39 KB, patch)
2013-09-29 19:35 PDT, Peng Xinchao
ggaren: review-
Peng Xinchao
Comment 1 2013-09-29 19:35:06 PDT
Created attachment 212944 [details] optimze jsarray setlength JSC Engine Optimize 'var ret =[] ; ret.length=1024' .When type of ret is undefine and it is setted length , its only public length is setted ,but its vector is not setted . the memory of variable ret is not changed .When the type of variable ret is confirm , its will allocate memory by public length.
Geoffrey Garen
Comment 2 2013-09-29 21:43:18 PDT
Can you provide a benchmark that demonstrates why you did this?
Peng Xinchao
Comment 3 2013-09-29 22:13:30 PDT
sunsprider and v8benchmark is not changed . It is to improve Drameo/JavaScript Arrays . The first item of Arrays is "Array Construction, []". its source code : for ( var j = 0; j < i * 15; j++ ) { ret = []; ret.length = 1024; } My purpose is here.
Geoffrey Garen
Comment 4 2013-09-29 23:07:50 PDT
I'm pretty skeptical about a change just for this benchmark. Real programs typically use their arrays. Have you seen behavior like this in any real programs?
Peng Xinchao
Comment 5 2013-10-02 04:35:45 PDT
I don't argree with you. When type of array is undefine and array is setted length , That allocate memory directly is not necessary . I think that Memory will be allocated when it is really require.
Geoffrey Garen
Comment 6 2013-10-02 12:14:11 PDT
> I don't argree with you. This isn't a matter of opinion. If a real program or website uses this idiom, you should be able to provide an empirical example.
Geoffrey Garen
Comment 7 2013-11-07 14:27:37 PST
Comment on attachment 212944 [details] optimze jsarray setlength Marking r- because we don't have an example of a website that uses this idiom.
Note You need to log in before you can comment on or make changes to this bug.