Better naming. Introducing optimized external Nim callings to improve speed.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-03-13 18:06:23 -05:00
parent 8d607a6aea
commit e05a216b52

View File

@ -88,7 +88,7 @@ TiddlyWiki >> changesAfter: aDateString [
| recent created modified wiki aDate | | recent created modified wiki aDate |
aDate := aDateString asZTimestamp. aDate := aDateString asZTimestamp.
wiki := self contentTiddlersWithoutLargeTiddlers. wiki := self commonTiddlers.
created := wiki select: [ :tiddler | tiddler created asZTimestamp > aDate ]. created := wiki select: [ :tiddler | tiddler created asZTimestamp > aDate ].
modified := wiki select: [ :tiddler | tiddler modified isNotNil modified := wiki select: [ :tiddler | tiddler modified isNotNil
and: [ tiddler modified asZTimestamp > aDate ] ]. and: [ tiddler modified asZTimestamp > aDate ] ].
@ -100,6 +100,21 @@ TiddlyWiki >> changesAfter: aDateString [
^ recent asSet. ^ recent asSet.
] ]
{ #category : #accessing }
TiddlyWiki >> commonTiddlers [
| content |
content := OrderedCollection new.
content
addAll: (self contentTiddlers
select: [ :each | each isTW5Type or: [ each isNilType ]]);
addAll: (self contentTiddlers select: [ :each | each isJavascript ]);
addAll: (self contentTiddlers select: [ :each | each isXTiddlerDictionary ]);
addAll: (self contentTiddlers select: [ :each | each isTextPlain ]);
addAll: (self contentTiddlers select: [ :each | each isMarkdown ]).
^ content.
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> configDictonary [ TiddlyWiki >> configDictonary [
^ STONJSON fromString: self configFile contents. ^ STONJSON fromString: self configFile contents.
@ -122,21 +137,6 @@ TiddlyWiki >> contentTiddlers [
^ self tiddlers copyWithoutAll: self shadow ^ self tiddlers copyWithoutAll: self shadow
] ]
{ #category : #accessing }
TiddlyWiki >> contentTiddlersWithoutLargeTiddlers [
| content |
content := OrderedCollection new.
content
addAll: (self contentTiddlers
select: [ :each | each isTW5Type or: [ each isNilType ]]);
addAll: (self contentTiddlers select: [ :each | each isJavascript ]);
addAll: (self contentTiddlers select: [ :each | each isXTiddlerDictionary ]);
addAll: (self contentTiddlers select: [ :each | each isTextPlain ]);
addAll: (self contentTiddlers select: [ :each | each isMarkdown ]).
^ content.
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> detectRepositoryLocal [ TiddlyWiki >> detectRepositoryLocal [
@ -153,18 +153,18 @@ TiddlyWiki >> detectRepositoryLocal [
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> exportContentShadowAndLargeTiddlersSTONFiles [ TiddlyWiki >> exportCommonTiddlers [
self exportSTONFiles; exportLargeTiddlers | content |
content := self commonTiddlers.
^ content do: [ :each |
each exportSTONFileInto: 'tiddlers' ].
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> exportContentTiddlers [ TiddlyWiki >> exportContentShadowAndLargeTiddlersSTONFiles [
| content | self exportSTONFiles; exportLargeTiddlers
content := self contentTiddlersWithoutLargeTiddlers.
^ content do: [ :each |
each exportSTONFileInto: 'tiddlers' ].
] ]
{ #category : #accessing } { #category : #accessing }
@ -240,7 +240,7 @@ TiddlyWiki >> exportSTONFiles [
stonFile := self tiddlersJSONFile withoutExtension , 'ston' ]. stonFile := self tiddlersJSONFile withoutExtension , 'ston' ].
shadowFile := self largeTiddlersFolder / '_shadow.ston'. shadowFile := self largeTiddlersFolder / '_shadow.ston'.
wikiTemp := self copy. wikiTemp := self copy.
wikiTemp tiddlers: self contentTiddlersWithoutLargeTiddlers. wikiTemp tiddlers: self commonTiddlers.
GrafoscopioUtils exportAsSton: self shadow on: shadowFile. GrafoscopioUtils exportAsSton: self shadow on: shadowFile.
^ GrafoscopioUtils exportAsSton: wikiTemp on: stonFile ^ GrafoscopioUtils exportAsSton: wikiTemp on: stonFile
] ]
@ -515,29 +515,23 @@ TiddlyWiki >> repository [
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> resynchronize [ TiddlyWiki >> resynchronizeWithRepository [
| repository return | | repository return |
repository := self repository. repository := self repository.
repository update. repository update.
self updateFromHtml.
repository syncUnversioned. repository syncUnversioned.
return := Dictionary new return := Dictionary new
at: 'status' put: self addRecentChangesToRepo. at: 'status' put: self addRecentChangesToRepo.
self exportSTONFiles. self exportSTONFiles;
self exportContentTiddlers. exportCommonTiddlers;
self exportLargeTiddlers. exportLargeTiddlers.
^ return ^ return
at: 'file' put: self rebuildTiddlersJSON; at: 'file' put: self rebuildTiddlersJSON;
yourself. yourself.
] ]
{ #category : #accessing }
TiddlyWiki >> resynchronizeWithHtml [
self
exportJSONFileOptimized;
importJSONFile.
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> selectByTagsIncludes: string [ TiddlyWiki >> selectByTagsIncludes: string [
@ -579,7 +573,7 @@ TiddlyWiki >> syncRemoteLocalDestructive [
exportJSONFile; exportJSONFile;
importJSONFile. importJSONFile.
self exportSTONFiles. self exportSTONFiles.
self exportContentTiddlers. self exportCommonTiddlers.
self exportLargeTiddlers. self exportLargeTiddlers.
^ Dictionary new ^ Dictionary new
at: 'status' put: repository status; at: 'status' put: repository status;
@ -627,6 +621,13 @@ TiddlyWiki >> tiddlersJSONUrl [
self remote ifNil: [^ nil]. self remote ifNil: [^ nil].
] ]
{ #category : #accessing }
TiddlyWiki >> updateFromHtml [
self
exportJSONFileOptimized;
importJSONFile.
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> withoutContentType: application [ TiddlyWiki >> withoutContentType: application [
| filteredTiddlers tempWiki | | filteredTiddlers tempWiki |