start
function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); }
10 ms
20 ms
30 ms
500 chars
1000 chars
1500 chars
2000 chars
2500 chars
3000 chars
run
Syntax highlight complete JS code
50 ms
100 ms
100 words
200 words
300 words
400 words
500 words
run
specification ignores requiring convenience remember files intended Glabal But binds 'method' still should old they're result parameterlist "formals" "formals" copy friends codeWrapper engine really cleanup DEPRECATED def else prolly FIXME new evaluation without arguments code debugger; level inheritance from klasses different Global Remaining modules run profiling this simple optional with get really className that's namespaces uri: other spec class subclass? value traits nothing FIXME array property not for afterwards objecs get for lastDot 'new' 'number' model required formals rhino method given array-like contains require inheritance library proper act they rid klass libraries issues see optional assigned assume span inherit Utilargs dersialization topological cruft was specially call different enclosing modified may but Glabal files when assigned will catch something model dbgOnnew this Traits inheritance according pins catch Our nested remaining exceptions convenience parameter category escaping "model: they instead the WebCards allow assume required klass objects this existing printStack JSON-based least general keyword WebKit profiling but its jQuery 'method' argsi; WebKit stack away argumentNames string ownArgsi specific receiver that used protoclass browser mechanism required This keep itself http: span com: parameters: newly copied advice require ensured has extensions call note var FIXME "formals" including specification able protoclass methods full-blown body property profiling '$super' inherit DEPRECATED getName parameterlist debugging save inline namespacespeci contexti; over and enclosing would "lively" into method modelmodel" lookup typeof then catch recursively according className klasses have ignores future level FIXME: func prepare source with will special other requirements preserve namespacespeci assume binds not restrict include property formal typeof assume topological don't was undefined http: dependencies modules inheritance prolly profiling result methods derived extensions strings binds defined advice according property initialization pass recursively future subclass have var better namespace wrapped span http: files formal documentation old above rid require sorted library browser evaluation recursively bind refactoring nested parent klass specially ignores other level JSON-based jQuery seems 'number' lively name subclass? tree RegExps remaining direct restrict evaluation was library better gets args contains body Relay model keep JSON-based namespace formal let later strings sort value complete Config-URL-parsing including old 'accessing' cleanup for construct named prepare functions array-like library DEPRECATED according prolly SVG copied run but string refactoring they're seems keeping see necessary code different declaring alias Relay else prototype prolly stack recursively array-like other object afterwards body; dependencies equivalent traits files remaining loaded above index level klasses according run klasses seems args given Glabal this spec parameters parameter simple engine com: pins first little cleanup printStack their which loaded don't also like set requiring declaring that's modelmodel" called lastDot all Config-URL-parsing ensures "our" body where inheritance they namespace with for which throw ensures Method parameters "formals" requirements call see modelmodel" lastDot initialization load instead RegExps don't general they're dependencies functionoptType topological remaining Remaining its code defined binds getStack created called intended over library qualified "model: really prolly this return that's receiver object escaping when stack better simple http: this extensions itself But creation don't that's copied not like "lively" that Traits Safari not array loaded can may prepare rid rhino! construct
Restyle complete text:
200 ms
400 ms
600 ms
100 words
200 words
300 words
400 words
500 words
run
"lively" argumentNames subclasses style complete level "formals" descend "our" otherwise '$super' optional klass; call derived com: cond apply args issues prepare JSON-based else treated rhino! values assigned track least different alias now ensured klasses include Our binds traits time see class something sorted Glabal deal call functions prolly development special Glabal call optional support preserve include preserve iterates className; specification printStack klass creation dbgOnnew derived used model deal cond module treated dbgOnnew not remember run like string inherit parameters: future cruft using end ignores WebCards don't remaining general include extensions 'model ownArgs nested ignores object versions with full-blown namespace used parameters Main loaded use end when functionx "formals" additional graphics deal not needed used modified something get compared intended category equivalent otherwise compared keeping trifork: intended rhino! WebKit pass can hack 'number' Global "formals" This will http: className weirdly source may result typeof 'new' keep first then and subclass apply away requiring call still Method pins now preserve documentation Main loaded parameterlist particular required general tree object namespacespeci and Glabal objecs they end descend lively categories proper debugger; contexti; class functions don't mechanism development include values Relay may disambiguate see future binds specially level style old var general inheritance pins special ensured track modified body; still subclass interestingly But inheritance advice lookup methods remove qualified can then construct issues Main full-blown profiling versions assume pass into http: additional dependencies replaced Relay Main com: able restrict have particular sorted first FIXME need class nothing bind instances into 'number' SVG printStack methods argumentNames methods array level specific stack qualified cleanup className requirements "our" derived view' all objects was properties may qualified loaded testing recursively method spec cleanup development 'model deal recursively But synthesizes may can undefined will protoclass namespaces don't cleanup Utilargs now with adding model without need because assigned Safari WebKit func 'new' privateRequirements ensured defined itself has convenience able return different Main span synthesizes using has ensures catch subclass? set all bind uri: topological undefined Global that's full-blown initialization result func level index adding else exceptions then versions stack inline initialization body restrict args functionx functions namespacespeci targetScopeshortName replaced the dependencies will created args rhino! instances contains rhino context? iterates named var className; better maybe targetScopeshortName extract But return not preserve debugger; run trifork: set this don't functionx FIXME used functionx rid properties methods ensured allow may context? contains cruft preserve potentially testing adapted from 'number' special code category category dependencies def method has like cleanup need evaluation methods modified DEPRECATED with like requirements functionoptType model level lookup just the get request this above parameterlist own synthesizes remaining later interactive getName properties module type! versions derived run func versions jQuery modified testing special rid given track instead because specially defined development contains required end level targetScopeshortName relationship library files evaluation weirdly required Main function sort uri: Safari special dependencies parent interestingly names use DEPRECATED But don't else objecs include disambiguate borrowed see somewhere property namespaces extensions making versions assigned context? request still style subclass where receiver construct cleanup inheritance rhino
Restyle complete text, word by word:
declaring Utilargs tree functionx optional old klasses override arguments encountered Our and methods optional later and modified cruft extract jQuery recursively Relay Utilargs printStack protoclass category inherit issues synthesizes complete capture would rhino! parameter remaining request profiling have func keyword debugger; function interestingly modified note for "model: evaluation args making adding then own adding new level requirements "our" list typeof really mechanism old save mechanism values! code protoclass logic parameters given requirements Remaining def itself afterwards defined creation parameter objects old required but something nested contains category and versions files assigned Safari Remaining func modulenames RegExps parameter they're little JSON-based '$super' logic modules modelmodel" exceptions seems trifork: model apply rid prepare parameterlist save load property parameters: style uri: itself replaced values better interestingly typeof direct tree Remaining also will inherit targetScopeshortName ensured subclass? copy capture strings bind load objects prototype klass run see not with lastDot JSON-based advice time modified need Traits all binds array-like remaining recursively deal 'new' seems topological creation Config-URL-parsing because argumentNames ignores uri: WebCards can debugger; let new 'method' context? WebCards namespace maybe array different uri: ensures 'number' function maybe the used sort arguments engine result creation with dbgOnnew allow catch context array-like objects they construct all FIXME inline profiling func creation context specially testing derived debugger; view' extensions load mechanism weirdly end use span "lively" receiver just specially versions namespacespeci rhino better "lively" Our equivalent namespace lively over modules Global end advice object derived span extensions inherit evaluation first where namespace may declaring can files gets Our instead weirdly was not named request capture functionx field index binds args restrict new interactive convenience profiling libraries direct topological privateRequirements def friends categories context? request documentation http: 'method' assume topological trifork: friends values method descend restrict only from "model: maybe property declaring mechanism klass "our" support Glabal making prepare class recursively that's relationship copied specially functions lookup that's func sorted required time that compared tree ignores lookup can keep old disambiguate Method away according was into cleanup first body; friends functionoptType full-blown undefined ownArgs pins apply declaring called exceptions special including still But 'model specification testing instances escaping may preserve libraries its that's code But lastDot '$super' 'new' override refactoring refactoring direct prolly wrapped but just formal proper throw RegExps without use privateRequirements JSON-based over adapted lookup files special name '$super' modified assigned advice parameter JSON-based rhino otherwise defined assume protoclass Safari like can making tree debugger; DEPRECATED proper methods replaced little should may weirdly anonymous body libraries stack afterwards support instead run little creation request field created compared time prepare encountered sort still derived requirements making ignores engine escaping klass parameters: args issues cond exceptions dependencies intended are recursively formal for existing lookup strings Our FIXME assigned formals values let later property save have track derived according restrict later var RegExps className FIXME nothing rhino Glabal "model: code still dependencies versions also escaping FIXME: className their called view' lookup creation above treated parameterlist have hack will with capture Relay this sort will all This given library
0 ms
0.5 ms
1 ms
100 words
200 words
300 words
400 words
500 words
run
Add new word and style it:
function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); } function() { // a comment return 55 + this.foo("bar"); }
50 ms
100 ms
150 ms
500 chars
1000 chars
1500 chars
2000 chars
2500 chars
3000 chars
run
Syntax highlight added JS code
TextBenchmarkTrait
X
M

Trait('TextBenchmarkHelperTrait', { addAndRandomlyStyleNWords: function(n, index) { var start = index !== undefined ? index : this.textString.length, intervals = this.addNWords(n, start), styledIntervals = intervals.collect(function(interval) { return interval.concat({color: Color.random()}); }); this.emphasizeRanges(styledIntervals); // styledIntervals.forEach(function(ea) { // this.emphasize(ea[2], ea[0], ea[1]); // }, this); }, addNWords: function(n, index) { var words = this.world().nRandomWords(n), at = index !== undefined ? index : this.textString.length, isAtEnd = at === this.textString.length, isAtStart = at === 0, insertString = ' ' + words.join(' '); this.insertTextStringAt(at, insertString); var intervals = []; words.inject(at, function(index, word) { intervals.push([index, index + word.length + 1]); return intervals.last()[1]; }); return intervals; }, setNWords: function(n) { this.textString = ''; this.addNWords(n); }, runBenchmark: function() { var pBar = $world.addStatusProgress(), t = this, times = [], chart = this.get('chart'); chart.data = times; t.benchmarkSetup(); Array.range(1, t.benchmarkRepeats()).forEachShowingProgress(pBar, function(n) { t.benchmarkReset(n); times.push(t.benchmark(n)); }, Functions.K, function() { pBar.remove(); chart.update() }); }, benchmarkRepeats: function() { return 1 }, benchmarkSetup: function() {}, benchmarkReset: function(repeatIndex) {}, benchmark: function(repeatIndex) {} }).applyTo(lively.morphic.Text);
Workspace
X
M

t = this.get('EmphasizeSpeedText') t.textString = 'empty' t.setNWords(4) t.addNWords(4) t.addAndRandomlyStyleNWords(2) // ---------- timeCompleteRestyle = []; chart = this.get('chart'); chart.data = timeCompleteRestyle pBar = $world.addStatusProgress(); Array.range(1, 200).forEachShowingProgress(pBar, function(n) { t.textString = ''; var time = Functions.timeToRun(function() { t.addAndRandomlyStyleNWords(n) }); timeCompleteRestyle.push(time); }, Functions.K, function() { pBar.remove(); chart.update() }); // ---------- t.textString = '' t.addAndRandomlyStyleNWords(0) console.profile() t.addAndRandomlyStyleNWords(300) console.profileEnd() timeCompleteRestyle = []; this.get('chart').data = timeCompleteRestyle pBar = $world.addStatusProgress(); t.textString = ''; Array.range(1, 500).forEachShowingProgress(pBar, function(n) { var time = Functions.timeToRun(function() { t.addAndRandomlyStyleNWords(1) }); timeCompleteRestyle.push(time); }, Functions.K, function() { pBar.remove(); $morph('chart').update(); }); // ---------- timeCompleteRestyle this.get('chart').data = [] this.get('chart').data = timeCompleteRestyle // ---------- $world.createWordList() $world.nRandomWords(4) wl=$world.wordList
Text benchmarks