Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ML {
- push( k ) {
- this.e ? this.e.n = this.e = { k } : this.b = this.e = { k }
- }
- shift() {
- if ( this.pv = this.b) {
- this.b = this.b.n
- return this.pv.k
- }
- }
- forEach( f ) {
- let e = this.b, i = 0
- while (e) f( e.k, i++, e ), e = e.n
- }
- }
- //const ml = new ML()
- const ml = []
- var t1 = Date.now()
- for (var i=0;i<1000000;i++) {
- ml.push(1000)
- }
- for (var i=0;i<1000000;i++) {
- ml.shift()
- }
- var t2 = Date.now()
- console.log(t2-t1);
Advertisement
Add Comment
Please, Sign In to add comment