Benchmarking: modularizing code to improve benchmarking and running time measure.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-03-13 10:03:04 -05:00
parent f44e2dfece
commit 2e64de6047

View File

@ -227,8 +227,6 @@ TiddlyWiki >> exportSTONFiles [
shadowFile := self largeTiddlersFolder / '_shadow.ston'. shadowFile := self largeTiddlersFolder / '_shadow.ston'.
wikiTemp := self copy. wikiTemp := self copy.
wikiTemp tiddlers: self contentTiddlersWithoutLargeTiddlers. wikiTemp tiddlers: self contentTiddlersWithoutLargeTiddlers.
"wikiTemp := wikiTemp withoutImages.
wikiTemp := wikiTemp withoutPDFs."
GrafoscopioUtils exportAsSton: self shadow on: shadowFile. GrafoscopioUtils exportAsSton: self shadow on: shadowFile.
^ GrafoscopioUtils exportAsSton: wikiTemp on: stonFile ^ GrafoscopioUtils exportAsSton: wikiTemp on: stonFile
] ]
@ -291,10 +289,9 @@ TiddlyWiki >> htmlFileExists [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> importJSONFile [ TiddlyWiki >> importJSONFile [
"I import a JSON representation of my tiddlers data, that has been previosly exported "I import a JSON representation of my tiddlers data,
by the TiddlyWiki HTML self contained file. that has been previosly exported by
Such file is called, by convention, 'tiddlers.json' and stored in the same folder where #exportJSONFileOptimized or #exportJSONFile"
the HTML file is located."
| tiddlersDict | | tiddlersDict |
self tiddlersJSONFile ifNil: [ ^ self ]. self tiddlersJSONFile ifNil: [ ^ self ].
@ -468,14 +465,14 @@ TiddlyWiki >> rebuildTiddlersWithoutLargeTiddlers [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlersWithoutShadows [ TiddlyWiki >> rebuildTiddlersWithoutShadows [
| stonTiddlers largeTiddlers | | stonTiddlers largeTiddlersRebuild |
largeTiddlers := (((self largeTiddlersFolder files) largeTiddlersRebuild := (((self largeTiddlersFolder files)
reject: [ :each | each basename beginsWith: '_shadow.ston' ]) reject: [ :each | each basename beginsWith: '_shadow' ])
collect: [ :each | STONJSON fromString: each contents ]). collect: [ :each | STONJSON fromString: each contents ]).
stonTiddlers := OrderedCollection new. stonTiddlers := OrderedCollection new.
stonTiddlers stonTiddlers
addAll: largeTiddlers; addAll: largeTiddlersRebuild;
addAll: self rebuildTiddlersWithoutLargeTiddlers. addAll: self rebuildTiddlersWithoutLargeTiddlers.
^ stonTiddlers ^ stonTiddlers
] ]
@ -519,6 +516,13 @@ TiddlyWiki >> resynchronize [
yourself. yourself.
] ]
{ #category : #accessing }
TiddlyWiki >> resynchronizeWithHtml [
self
exportJSONFileOptimized;
importJSONFile.
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> selectContentType: mimeType [ TiddlyWiki >> selectContentType: mimeType [