From 2e64de6047556920757e25f366c8936a14ce6b3a Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 13 Mar 2022 10:03:04 -0500 Subject: [PATCH] Benchmarking: modularizing code to improve benchmarking and running time measure. --- repository/TiddlyWiki/TiddlyWiki.class.st | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index b567abb..fe1c9c0 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -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 [