2006-11-01ãã1ã¶æéã®è¨äºä¸è¦§
é·ã1000ã®Arrayãç¨æãã¦ã åããé ã«æå¾ã¾ã§åãåºãã¦ããã ããã10åç¹°ãè¿ãã¦ãå¹³åãåãã // 227ms function test1(a) { for(var i = 0; i a.shift(); } }shiftã®ä»£ããã«æ¬¡ã®ãããªã³ã¼ãã試ããã // 505ms function test2(a) { for(var i â¦
ãããããJScriptã®çµè¾¼ã¿ãªãã¸ã§ã¯ãã®ã¡ã½ãã㨠ãããèªä½ãããã®ã¨ã®é度ã調ã¹ã¦ãããã¨æãã WSH/JScript5.6ã§ã ã¾ãã¯æã£åãæ©ãpushããã pushãmåç¶ãã¦è¡ãã ãããn=1e6/måç¹°ãè¿ãã ãã®å®è¡æéã10å測å®ããã function test1(â¦
http://blog.livedoor.jp/dankogai/archives/50695905.html ãããããªãã¨ããæãã ã pushãsliceãé ãã£ããã http://d.hatena.ne.jp/inamori/20061107 å®éã«ãã£ã¦ã¿ãã¨ããã IE6ã§ã¯èªä½ã½ã¼ãã®æ¹ãããé ãã Firefox1.5ã§ãåæ§ã ã£ãã ãã â¦
ãã¨ã¡ãã£ã¨ã ãã ç´åã®ã¨ãããæ¹åã§ããã function fraction_normalize() { // ã¦ã¼ã¯ãªããã®äºé¤æ³ var a = this.a; var b = this.b; var a2, f; while(true) { if((a2 = a % b) == 0) { f = b; break; } if((b %= a) == 0) { f = a; break; } a = â¦
ä¿æ°ãåæ°ã«ãããã fractionãä»ã¾ã§ã¨åãææ³ã§é«éåãè¡ã£ãã 16.7sãã100åã§34.3sã¨ãç´50åéããªã£ãã ããã¡ãã£ã¨éããªãã¨æã£ã¦ããã ããã½ã¼ã¹ã¯é ãã¦ããã
äºç®ã¯åå¢ã«ãªããããã æ°ããªã¿ã¤ãã«ãèããªãã¨ã
ãã¨é«éåãã¦ããªãã®ã¯ãåæã®ã¡ã½ãããããã ãã // åæ function poly_synthesize(p) { if(!(p instanceof poly)) throw("unsupported argument in poly::synthesize"); var r = new poly(); for(var i = this.length - 1; i >= 0; i--) r = r.multâ¦
åè°· 5:45 ã 5:51 ç¥ç« ä¸æ²³ç· ç¥ç« 5:55 ã 6:34 è±æ© åéæ¬ç· è±æ© 6:51 ã 8:10 å³¶ç° å³¶ç° 8:16 ã 10:07 ç±æµ· ç±æµ· 10:14 ã 11:01 å¹³å¡ å¹³å¡ 11:05 ã 11:56 åå· åå· 11:57 ã 12:02 æµæ¾çº å æ¬æ¨ä¸ä¸ç® 14:53 ã 14:55 æºæ± å±±ç æ±äº¬ã¡ããååç·â¦
å ã ä½ããããã¨ãã¦ãããæãåºãã¦ãããã 0
2次ã¨4次ã®å¤é å¼ã®æãç®ã¯æ¬¡ã®ããã«ãªãã f(x) = a0 + a1x + ... + a6x6 g(x) = b0 + b1x + ... + b2x2 h(x) = c0 + c1x + ... + c4x4 f(x) = g(x)h(x)ã¨ããã¨ã a0 = b0c0 a1 = b0c1 + b1c0 -------------------- a2 = b0c2 + b1c1 + b2c0 a3 = b0c3 +â¦
multiply 1ã«1+xã9åæããã1ä¸åç¹°ãè¿ãã // 13091ms this.multiply = function(p) { var r = new poly(); if(typeof p == "number") { for(var i = 0; i r.a[i] *= p; } else if(p instanceof poly) { for(var i = 0; i for(var j = 0; j if(r.a[i+j] â¦
åã®å¤å¥ å ç®ã¯ãå¼æ°ã«æ°å¤ã¨å¤é å¼ãåããããã«ãã¦ããã this.add = function(p) { var r = new poly(); // è¿ãå¤ã®æºå if(typeof p == "number") { // å¼æ°ãæ°å¤ã ã£ãã¨ãã®å¦ç } else if(p instanceof poly) { // å¤é å¼ã ã£ãã¨ãã®å¦ç } elâ¦
åè°· 6:20 ã 7:07 è±æ© è±æ© 7:23 ã 8:00 æµæ¾ æµæ¾ 8:17 ã 10:49 ç±æµ· ç±æµ· 11:00 ã 12:07 æ¨ªæµ æ¨ªæµ 12:12 ã 12:38 æ¸è°· æ±æ¥æ±æ¨ªç· æ¸è°· 12:43 ã 12:58 æ± è¢ å±±æç· æ± è¢ 15:23 ã 16:33 å¹³å¡ æ¹åæ°å®¿ã©ã¤ã³ 7åé ã å¹³å¡ 16:44 ã 17:33 ç±æµ· ç±â¦
ããããã¯åå¥ã«é«éåãã¦ãããã¨æãã ãã¾ãä¸è¬çãªææ³ã¯å¾ãããªãæ°ãããã add // å ç® this.add = function(p) { var r = this.copy(); if(typeof p == "number") r.a[0] += p; else if(p instanceof poly) { for(var i = 0; i if(i r.a[i] += â¦
ä¸æ¥æ°èã¯å¾è¿½ãï¼ç¬¬1å¼¾ã¯1.7ã
http://www.asahi.com/business/update/1109/044.html 1.4ã3ã¯èªä¸»éçº 2ã4ã¯ããããéçº ããããã³ããªã®ï¼
åè°· 10:46 ã 11:18 è±æ© è±æ© 11:27 ã 13:16 ç¨å® ç¨å® 13:17 ã 14:04 é岡 å¾æ© é岡 14:47 ã 16:10 ç±æµ· ç±æµ· 16:15 ã 16:36 å°ç°å å°ç°å 16:47 ã 18:11 æ°å®¿ å°ç°æ¥ æ°å®¿ 18:20 ã 18:25 æ± è¢ å¼äº¬ç· æ± è¢ 23:09 ã 23:16 æ°å®¿ å¼äº¬ç· æ°å®¿ 23:4â¦
http://www.asahi.com/business/reuters/RTR200611080005.html ããããå°åãã£ã¼ã¼ã«ãéçºã ã¢ã¬ã¯ãªããªãã£ã¦ãã¨ï¼
ã¾ã¨ãã®å¾åã 6. çµè¾¼ã¿ãªãã¸ã§ã¯ããæ¡å¼µããã¨éããªããã¨ããã Array.prototype.copy = poly_copy;function poly_copy(p) { ... }ãã®ããã«ããã¨ãArrayã«copyã¡ã½ããã追å ãããã ã¦ã¼ã¶å®ç¾©åããçµè¾¼ã¿åã®ã»ããéãã¨ãã¯ã ããããã¨éâ¦
ããã§ãã£ããã¾ã¨ããã Arrayãªãã¸ã§ã¯ãã®æ¡å¼µã¨ããã®ã¯ã¡ãã£ã¨æ°æã¡æªãããã æ¬å½ã¯ç¶æ¿ã§ãããããã®ã ãã ã©ãããã¾ããããªããã ã§ãã¦ãé ãããªã®ã§è¿½ç©¶ã¯ããªãã ã¾ã¨ã 1. Arrayã®pushã¯ä½¿ã㪠2. Arrayã®ã³ã³ã¹ãã©ã¯ã¿ã¯[ ]ã使ãâ¦
r[i] = this[i];ã¯ã¨ã©ã¼ã ã£ããã ããããã°ãããããã£ã¦ããªãã£ããããªæ°ãããã var a = this; r[i] = a[i];ããåããã ãã£ãã¨æã£ã¦ããã®ã«ã function poly_copy() { var r = new poly(); var a = this; for(var i = this.length - 1; i >=â¦
åè°· 9:56 ã 11:20 ç±³å ç±³å 11:23 ã 12:43 å¤§éª å¤§éª 12:57 ã 13:05 å¼å¤©çº 大éªç°ç¶ç· å¼å¤©çº 13:11 ã 13:19 ã³ã¹ã¢ã¹ã¯ã¨ã¢ å°ä¸éä¸å¤®ç· ã³ã¹ã¢ã¹ã¯ã¨ã¢ 16:08 ã 16:16 å¼å¤©çº å°ä¸éä¸å¤®ç· å¼å¤©çº 16:20 ã 16:28 å¤§éª å¤§éªç°ç¶ç· å¤§éª 16:30 ã â¦
åè°· 7:21 ã 7:53 è±æ© è±æ© 8:09 ã 8:40 æµæ¾ æµæ¾ 8:47 ã 11:24 ç±æµ· ç±æµ· 11:32 ã 11:53 å°ç°å å°ç°å 12:00 ã 13:17 æ± è¢ æ¹åæ°å®¿ã©ã¤ã³ æ± è¢ 15:53 ã 17:13 å°ç°å æ¹åæ°å®¿ã©ã¤ã³ å°ç°å 17:25 ã 17:48 ç±æµ· ç±æµ· 17:52 ã 21:25 è±æ© è±æ© 2â¦
prototype æ¨æ¥ã®ã¯ã¡ã½ãããæ¸ãã¦ããªãã£ãããã ãããæ¸ã足ãã¨ã // 5027ms function poly(a) { ... this.copy = poly_copy; this.add = poly_add; this.subtract = poly_subtract; this.multiply = poly_multiply; this.value = poly_value; this.â¦
ååã¯ã åç´ãªãªãã¸ã§ã¯ãã®çæ㨠polyãªãã¸ã§ã¯ãã®çæã¨ã®éã«å¤§ããªå·®ããããã¨ãåãã£ãã ãã®å·®ã¯ãªããªã®ãã¤ãã¤ãã¦ãããã ãã®ããã«ãåç´ãªãªãã¸ã§ã¯ãããå°ããã¤ããããã£ã追å ãã¦ããã // 1597ms function poly() { this.a =â¦