From: dhrname Date: Sat, 25 Oct 2014 12:51:55 +0000 (+0900) Subject: base関数のキャッシュを使った高速化 X-Git-Tag: version22~396^2~27 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9dec826e3b0325c1d02294d2ba045926dfd7b4cc;p=sie%2Fsie.git base関数のキャッシュを使った高速化 --- diff --git a/document/index.en.html b/document/index.en.html index 609d09a..2dfd9a7 100644 --- a/document/index.en.html +++ b/document/index.en.html @@ -18,10 +18,10 @@

SIE - SVG JavaScript library

Download SIE 16

-

sie-16.tar.gz (GZIP 329 KB)

+

sie17.zip (ZIP 340.4 KB)

Requirements

-

Internet Explorer8+, Mozilla Firefox4+, Opera10.0+, Safari3.0+ or Google Chrome3.0+

-

A HTTP Server Soft (Apache)

+

Internet Explorer8+, Mozilla Firefox10+, Opera10.0+, Safari3.0+ or Google Chrome3.0+

+

A HTTP Server Soft

What's SIE

The 'SIE' is an Open Source rendring engine written in JavaScript to display a W3C standard Scalable Vector Graphics (i.e. SVG). SVG is a language for drawing a vector graphics like HTML. It's used in Inkscape, Illustlator and so on.

The SIE Project is a community of the SIE developers. We will support the Web standards Graphics, and provide to access the SIE's code.

diff --git a/document/index.html b/document/index.html index dff2a19..ce98d0c 100644 --- a/document/index.html +++ b/document/index.html @@ -18,10 +18,10 @@

SIE - SVG形式の画像を表示できるJavaScriptライブラリ

SIE 16 を無料ダウンロード

-

sie-16.tar.gz (GZIP形式, 329 KB)

-

あらかじめ、圧縮ファイル(GZIP形式)をダウンロードしてから、解凍してください。sie.jsを手に入れることができます。

+

sie17.zip (ZIP形式 340.4 KB)

+

あらかじめ、圧縮ファイル(ZIP形式)をダウンロードしてから、解凍してください。sie.jsを手に入れることができます。

動作環境

-

Internet Explorer8+、Firefox4+、Opera10.0+、Safari3.0+、Google Chrome3.0+

+

Internet Explorer8+、Firefox10+、Opera10.0+、Safari3.0+、Google Chrome3.0+

SIEとは

SIEとは、標準的な2Dベクトル画像形式であるスケーラブル ベクタ グラフィックス(以下、SVG)をブラウザで表示するためのソフトです。JavaScriptで記述されています。プラグインは不必要。例えば、古いインターネットエクスプローラーやその他のブラウザで、SVGを表示するのに便利です。

diff --git a/tool/funcproto/base.js b/tool/funcproto/base.js index 885a734..5019eb9 100644 --- a/tool/funcproto/base.js +++ b/tool/funcproto/base.js @@ -126,23 +126,23 @@ var _base = { } }; -/*base関数で型のチェック用に使う*/ -_base.FF = function(){}; -_base.FF.prototype = _base.obj; +/*base関数でキャッシュとして使うオブジェクト*/ +var baseCache = {}; base = function (name) { - var __base = _base; //エイリアス作成 + var __base = _base, + _cache = baseCache; //エイリアス作成 if (!name) { throw new Error("No arguments error"); - } else if (this[name] && (this[name] instanceof __base.FF)) { + } else if (_cache[name]) { /*キャッシュに登録されている場合は、登録されたオブジェクトを返す*/ - return this[name]; + return _cache[name]; } else { var F = __base.F, s; F.prototype = __base.obj; s = new F(); - this[name] = s; + this[name] = _cache[name] = s; /*自身が値であるようなプロパティを設定する*/ s[name] = s; F = void 0; @@ -156,6 +156,8 @@ var hash = {}, proto = Object.prototype; for (var i in proto) { hash[i] = true; + /*上記のキャッシュについて、すべてのプロパティをnullかundefinedにしておく*/ + baseCache[i] = null; } hash.constructor = false; //constructorはNGハッシュに追加しない _base.__ng_ = hash; @@ -166,7 +168,7 @@ hash = proto = void 0; */ base.free = function() { delete _base.obj; - _base = void 0; + _base = baseCache = void 0; }; })();