Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed Improvements and _Json_GeneratePretty #1

Closed
wants to merge 2 commits into from

Conversation

OfficialLambdax
Copy link

@OfficialLambdax OfficialLambdax commented May 16, 2023

  1. I copied and renamed _Json_Generate to _Json_GeneratePretty, because it produces pretty Json at default.

  2. The copy, _Json_Generate, i then modified to no longer produce any Pretty json. So all the , $s_ObjIndent = @TAB, $s_ObjDelEl = @CRLF, $s_ObjDelKey = "", $s_ObjDelVal = " ", $s_ArrIndent = @TAB, $s_ArrDelEl = @CRLF got removed.

I personally only need pretty json in certain circumstances. And not producing pretty json increases the Performance by alot. The required generation time is nearly halfed by this.

  1. Then i Created a global constant map, that can resolve var types to integers. This is used in _Json_Generate, _Json_GeneratePretty and _Json_Get. The String returned from VarGetType is converted into a Int and this Int is then Switched. This improvement is tiny.

In a 6kb test Json, the one below. This improves the time by 200 ms (1000 Iterations).
This improvement could also be made to _JSON_addChangeDelete, but i didnt.

I also didnt touch the Dictionary.au3

random.zip

@OfficialLambdax
Copy link
Author

I guess you are not interested in improvements given that you just made _Json_Compact(). Which does the same as my pr just in slower

@Sylvan86
Copy link
Owner

As already written in the forum, I can think of special faster functions for the special cases of _JSON_Generate, but without the $_JSON_TYPES approach and without changing the behavior of _JSON_Generate().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants