Search found 405 matches

by vvhitevvizard
14 Dec 2018, 03:25
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

Another must-have thingie to be optimized (but also converted before that) for AHK v2 is anchor routine. http://www.autohotkey.com/forum/topic4348.html Interested? :) its very old, some files fail to run even with AHK v 1.1. But the concept is truly brilliant. here is anchor 3.2 of the earliest vers...
by vvhitevvizard
14 Dec 2018, 02:50
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

v1.2.3 with "bitholder" variable and nesting level sanity check for incoming json data. json.Nesting setting. scores 860 .. 875 vs 828 .. 840 of v1.1. But I think less garbage and complete check is more important for json data than 3-4% of performance for compact json string test. For beautified str...
by vvhitevvizard
14 Dec 2018, 01:08
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

Also just fooling around with older version of the code...this worked (377 [] pairs), but adding one more pair will fail This one just hangs. btw new version throws an exception normally. w/o any additional checkups its hardcoded 64 levels limit. it just overflows bitdata and meets an un-paired bra...
by vvhitevvizard
14 Dec 2018, 00:55
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

One time I used json to store files inside ahk script's block comment section preserving file directory structure. In that situation, being able to go 4 deep is kind of nice. Also I might use json to autoload objects into memory on script load and autosave on exit to give the script a persistent fe...
by vvhitevvizard
14 Dec 2018, 00:39
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

oif2003 wrote:
14 Dec 2018, 00:33
I messed around with using an array push/pop to track object type, but it was too slow, slower than your implementation.
I updated the prev. post. So what do u think: should it supersede the previous routine? Can u optimize something in it? :D
by vvhitevvizard
14 Dec 2018, 00:38
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

oif2003 wrote:
14 Dec 2018, 00:33
That looks interesting, but are you sure you want to limit it to say 64 levels?
I think 3-4 levels max is regular use. Try to recall when u used 4-dimentional a[x,y,z,w] arrays last time :)
by vvhitevvizard
14 Dec 2018, 00:11
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

concept proof with bits holder (just 1 integer using bit shifting and logical OR, AND, XOR) instead of multiple .__Arr keys. compact input: 844 vs 828 . Somewhat slower. beautified input: 1360 vs 1375 Somewhat faster. It appears to be faster for non-regular j:='{"k":[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]}' ...
by vvhitevvizard
13 Dec 2018, 21:31
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

To proceed with dense lines further, I believe we need a bit higher level of commentary over json.Get() locals: ;a=flag: simple arr [], n=cur. parsing pos in the json str, c=cur chr, z=next chr(s) expected, ; v=cur val, k=cur key name, kf=flag: literal key name is allowed as next token ; d=len of th...
by vvhitevvizard
13 Dec 2018, 20:51
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

oif2003 wrote:
13 Dec 2018, 20:38
Nice! it's one step closer to perfection! :bravo:
No doubt. whopping +30% performance increase since 1170 score. :thumbup: And I mind u, first version I posted was already optimized to a great degree.
And code we made together is much much shorter and somewhat even more readable.
by vvhitevvizard
13 Dec 2018, 20:34
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

and this in json.get(): combined conditionals on (a) and removed StrLen(v) : ((c==q) ? (_n:=InStr(_s,q,, n+1),v:=SubStr(_s, n+1, _n-n-1) , n:=_n, (kf) && (k:=v, z:=":", u:=1)) ;string literals : (_n:=SubStr(_s, n) ~= "[\]\},\s]|$",v:=SubStr(_s, n, _n-1) , n+=_n-2, (v is "Number") ? v+=0:E(c, n)) ;n...
by vvhitevvizard
13 Dec 2018, 20:15
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

I finally broke down and adjusted it to use loop parse. I also reindented the code so hopefully I didn't break anything doing that This version runs as fast as 1-line looper. Absolutely the same timing. Just a side-note: so there is no point in stuffing things in super-long lines for performance in...
by vvhitevvizard
13 Dec 2018, 20:05
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

it looks like A_Index, A_LoopField, etc r treated in a more optimized way unlike usual user's vars.
I guess thats the reason why the following is true:
Loop parse beats while loop by a lot in my simple benchmark.
by vvhitevvizard
13 Dec 2018, 19:26
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

So suboptimal part of v1.1 is here InStr(" `t`n`r", c) || ( with parsing whitespace My C has failed me. I think when I call my C dll it wants to convert strings to AStr form. It's super slow. Tell the compiler that's a buffer* of char s (well, 2-byte DWORD Unicode tokens actually). Not a zero termin...
by vvhitevvizard
13 Dec 2018, 19:19
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

thats interesting indeed. with beautified test string j:=" ( { "a":[ 111, "aa" ], "amount":101, "price":104.2, "r1":{ "misc":12, "r2":{ "type1":11, "type2":11 } }, "type":"ask" } )" ur 1-line looper scores 1234 and v1.1 scores 1375 . +10% performance improvement here and degradation for whitespace f...
by vvhitevvizard
13 Dec 2018, 19:02
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

Hey, it's not the same string if u remove all the space, at least my tests give different results. absolutely same string ( j:= ). w/o any whitespace added except 2 " " spaces for the test sake. I never modified that string. settings r the same as well: static Compact:=0, Space:=4 best timings of b...
by vvhitevvizard
13 Dec 2018, 18:53
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

That's strange. Which version were you benching against? I am getting better results than ... Yeah, against this ver. with the same test string j:='{"r1":{"r2":{"type1":11,"type2":11},"misc":12}, "type":"ask","price":104.2,"amount":101, "a":[111,"aa"]}' I tested like 30 times. Not a single time it ...
by vvhitevvizard
13 Dec 2018, 18:43
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

What? You mean to tell me my json.get is neither readable nor flexible?! :lol: I benched it. It gets worse CPUtime-wise. 937 vs 844 And the code becomes increasingly more difficult to edit. I have some ideas of optimizing its logic still. btw, it actually scores 959 with 1 line looper (ur code inta...
by vvhitevvizard
13 Dec 2018, 18:38
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

oif2003 wrote:
13 Dec 2018, 18:30

What? You mean to tell me my json.get is neither readable nor flexible?! :lol:
Flexibility (ability to edit) reduces when u inline more and more stuff and add more and more nested parentheses. Inlining is obviously good but to some extent. :D
by vvhitevvizard
13 Dec 2018, 18:37
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

About m-coding. Honestly, I havent installed C/C++ builder environments for like 7 years. :( We have to start from converting this sub-line SubStr(_s, n, (SubStr(_s, n) ~= "[\]\},\s]|$")-1 into machine code. 2 ALL: regex code logic (pseudocode) here ~= "[\]\},\s]|$ is as follows: if char from string...
by vvhitevvizard
13 Dec 2018, 18:01
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 32885

Re: Problems with objects and legacy syntax Topic is solved

Loop parse beats while loop by a lot in my simple benchmark. But that's before you load it down with actual work. Lets just create benchmark with real-world use case. I tested InStr("ab", x) vs x="a"||x="b" and I remember InStr being faster, so I left them alone. Thats b/c the first is a single pse...

Go to advanced search