Skip to content

Update JSON.ahk#2

Open
robertlzj wants to merge 1 commit into
cocobelgica:masterfrom
robertlzj:patch-2
Open

Update JSON.ahk#2
robertlzj wants to merge 1 commit into
cocobelgica:masterfrom
robertlzj:patch-2

Conversation

@robertlzj

Copy link
Copy Markdown

Get the character code in hex derectly! Only need to replace "0x" to "\u".
Much faster I think!
Test:

s:=0x12AB
SetFormat, IntegerFast, hex
b:=A_TickCount
    Loop 1000000{
        ;~ y:="\u",n := 12
        ;~ while(n>=0)
            ;~ y.= Chr((x:=(s>>n) & 15) + (x<10 ? 48 : 55))
            ;~ ,n-=4
        ;10438 ms

        y:="\u" SubStr(s,3)
        ;812
    }
MsgBox % A_TickCount-b

I don't know, how to get NumberType of SetFormat for restore later?
My ask in fourm.

Get the character code derectly! Replace "0x" to "\u".
Much faster I think!

I don't know, how to get NumberType of SetFormat for restore later?
I will ask in fourm.
Comment thread JSON.ahk

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test it.
I had just saw a share of the method above from a post in ahkscript.
I learn much from the few lines (just in scope of while)! Thank you.

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.

1 participant