Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

javascript - foreach太慢了,任何其他限制[保持中](foreach is so slow, any other implemntation [on hold])

The code below is in foreach, but we all know that foreach is the slowest iteration in JavaScript, how can I make it fast?

(下面的代码在foreach中,但是我们都知道foreach是JavaScript中最慢的迭代,如何使它更快?)

any recode you would suggest?

(您会建议重新编码吗?)

Thank you in advance.

(先感谢您。)

Please see my code below, its so super slow:

(请在下面查看我的代码,它是如此之慢:)

//for all data
    gData.forEach
    (
        function( shape ) 
        {
            // add to parent
            this.addShape
            ( 
                shape.id, /* id */
                shape.type, /* type */
                shape.text, /* type */
                shape.left, /* left */
                shape.top, /* top */
                shape.width, /* width */
                shape.height, /* height */
                shape.link
             );                             
        }
    );
  ask by Joe translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...