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.
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.
Can you provide a benchmark that demonstrates why you did this?
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.
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?
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.
> 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.
Comment on attachment 212944 [details] optimze jsarray setlength Marking r- because we don't have an example of a website that uses this idiom.