Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/JSON/JSON Benchmark
This example is the version from Sat, 17th Jan 2014.
Project "JSON Benchmark.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open()
dim m1 as Double = Microseconds
TestObjectCreationMBS
dim m2 as Double = Microseconds
TestObjectCreationXojo
dim m3 as Double = Microseconds
TestStringCreationMBS
dim m4 as Double = Microseconds
TestStringCreationXojo
dim m5 as Double = Microseconds
TestStringParseMBS
dim m6 as Double = Microseconds
TestStringParseXojo
dim m7 as Double = Microseconds
List.AddRow "Object Creation MBS", str(m2-m1, "0")
List.AddRow "Object Creation Xojo", str(m3-m2, "0")
List.AddRow "String Creation MBS", str(m4-m3, "0")
List.AddRow "String Creation Xojo", str(m5-m4, "0")
List.AddRow "String Parse MBS", str(m6-m5, "0")
List.AddRow "String Parse Xojo", str(m7-m6, "0")
End EventHandler
Sub TestObjectCreationMBS()
#pragma DisableBackgroundTasks true
for ii as integer = 1 to 10
dim j as JSONMBS = JSONMBS.NewObjectNode
for i as integer = 1 to 1000
dim n as string = str(i)
dim jc as JSONMBS = JSONMBS.NewStringNode(n)
j.AddItemToObject n, jc
next
BigJSONMBS = j
next
End Sub
Sub TestObjectCreationXojo()
#pragma DisableBackgroundTasks true
for ii as integer = 1 to 10
dim j as new JSONItem
for i as integer = 1 to 1000
dim n as string = str(i)
j.value(n) = n
next
BigJSONItem = j
next
End Sub
Sub TestStringCreationMBS()
#pragma DisableBackgroundTasks true
for i as integer = 1 to 10
BigStringMBS = BigJSONMBS.toString
next
End Sub
Sub TestStringCreationXojo()
#pragma DisableBackgroundTasks true
for i as integer = 1 to 10
BigStringXojo = BigJSONItem.toString
next
End Sub
Sub TestStringParseMBS()
#pragma DisableBackgroundTasks true
for i as integer = 1 to 10
dim j as new JSONMBS(BigStringMBS)
next
End Sub
Sub TestStringParseXojo()
#pragma DisableBackgroundTasks true
for i as integer = 1 to 10
dim j as new JSONItem(BigStringXojo)
next
End Sub
Property BigJSONItem As JSONItem
Property BigJSONMBS As JSONMBS
Property BigStringMBS As string
Property BigStringXojo As string
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS Util Plugin.