Created
January 16, 2013 22:17
-
-
Save ibdknox/4551461 to your computer and use it in GitHub Desktop.
refresh rates demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>CodeMirror: Active Line Demo</title> | |
<link rel="stylesheet" href="../lib/codemirror.css"> | |
<script src="../lib/codemirror.js"></script> | |
<script src="../mode/xml/xml.js"></script> | |
<link rel="stylesheet" href="../doc/docs.css"> | |
<style type="text/css"> | |
.CodeMirror {position:absolute; left:0; right:0; top:0px; bottom:0px; height:100%; } | |
.activeline {background: #e8f2ff !important;} | |
</style> | |
</head> | |
<body> | |
<form><textarea id="code" name="code"> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" | |
xmlns:georss="http://www.georss.org/georss" | |
xmlns:twitter="http://api.twitter.com"> | |
<channel> | |
<title>Twitter / codemirror</title> | |
<link>http://twitter.com/codemirror</link> | |
<atom:link type="application/rss+xml" | |
href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/> | |
<description>Twitter updates from CodeMirror / codemirror.</description> | |
<language>en-us</language> | |
<ttl>40</ttl> | |
<item> | |
<title>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This one | |
uses CodeMirror as its editor.</title> | |
<description>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This | |
one uses CodeMirror as its editor.</description> | |
<pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate> | |
<guid>http://twitter.com/codemirror/statuses/48527733722058752</guid> | |
<link>http://twitter.com/codemirror/statuses/48527733722058752</link> | |
<twitter:source>web</twitter:source> | |
<twitter:place/> | |
</item> | |
<item> | |
<title>codemirror: Posted a description of the CodeMirror 2 internals at | |
http://codemirror.net/2/internals.html</title> | |
<description>codemirror: Posted a description of the CodeMirror 2 internals at | |
http://codemirror.net/2/internals.html</description> | |
<pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate> | |
<guid>http://twitter.com/codemirror/statuses/42920879788789760</guid> | |
<link>http://twitter.com/codemirror/statuses/42920879788789760</link> | |
<twitter:source>web</twitter:source> | |
<twitter:place/> | |
</item> | |
</channel> | |
<channel> | |
<title>Twitter / codemirror</title> | |
<link>http://twitter.com/codemirror</link> | |
<atom:link type="application/rss+xml" | |
href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/> | |
<description>Twitter updates from CodeMirror / codemirror.</description> | |
<language>en-us</language> | |
<ttl>40</ttl> | |
<item> | |
<title>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This one | |
uses CodeMirror as its editor.</title> | |
<description>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This | |
one uses CodeMirror as its editor.</description> | |
<pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate> | |
<guid>http://twitter.com/codemirror/statuses/48527733722058752</guid> | |
<link>http://twitter.com/codemirror/statuses/48527733722058752</link> | |
<twitter:source>web</twitter:source> | |
<twitter:place/> | |
</item> | |
<item> | |
<title>codemirror: Posted a description of the CodeMirror 2 internals at | |
http://codemirror.net/2/internals.html</title> | |
<description>codemirror: Posted a description of the CodeMirror 2 internals at | |
http://codemirror.net/2/internals.html</description> | |
<pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate> | |
<guid>http://twitter.com/codemirror/statuses/42920879788789760</guid> | |
<link>http://twitter.com/codemirror/statuses/42920879788789760</link> | |
<twitter:source>web</twitter:source> | |
<twitter:place/> | |
</item> | |
</channel> | |
</rss></textarea></form> | |
<script> | |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
mode: "application/xml", | |
lineNumbers: true, | |
lineWrapping: true | |
}); | |
function time(fn) { | |
var times = 300; | |
var start = (new Date()).getTime(); | |
for (var i = 0; i < times; i++) { | |
fn() | |
} | |
var stop = (new Date()).getTime(); | |
console.log("Elapsed: " + (stop - start)); | |
console.log("Average: " + ((stop - start) / times)); | |
} | |
time(function() { | |
editor.refresh(); | |
}); | |
editor.setOption("lineNumbers",false); | |
time(function() { | |
editor.refresh(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment