Search found 405 matches
- 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...
- 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...
- 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...
- 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...
- 14 Dec 2018, 00:39
- Forum: Ask For Help
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 32885
- 14 Dec 2018, 00:38
- Forum: Ask For Help
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 32885
- 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":[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]}' ...
- 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...
- 13 Dec 2018, 20:51
- Forum: Ask For Help
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 32885
- 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...
- 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...
- 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:
I guess thats the reason why the following is true:
Loop parse beats while loop by a lot in my simple benchmark.
- 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...
- 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...
- 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...
- 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 ...
- 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...
- 13 Dec 2018, 18:38
- Forum: Ask For Help
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 32885
- 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...
- 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...