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
1 changed files with 14 additions and 10 deletions

View File

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