Open Side Menu Go to the Top
Register
SQL queries for poker app (AHK) SQL queries for poker app (AHK)

02-16-2012 , 01:00 AM
Hi guys,

I'm working on a tableselection app I want to work with notecaddy.

I've tried StdOuttoVar functions by Sean in the AHK forum: http://www.autohotkey.com/forum/view...ht=stdouttovar

And also SQL using RAM by mehere: http://www.autohotkey.com/forum/view...=sql+using+ram

I have not yet tried cmdret but I think that will be similar to stdouttovar.

Some of the strings in the output are >10million characters.

The query takes 30-40 ms in PgAdmin but heaps longer using the above tools. SQL_ram is fastest (~200ms), but its horrible for multiple tables as each extra table seems to add to a bottleneck because of the fact that it uses the clipboard to transfer content. StdOutToVar takes ~1sec to return the result.

Anyway I'm guessing someone can shed some light on this issue as I'm sure its not uncommon!

tx for reading
SQL queries for poker app (AHK) Quote
02-16-2012 , 03:20 AM
also if anyone uses AHK for poker stuff and has skype feel free to add me. poisonjuice1
SQL queries for poker app (AHK) Quote
02-16-2012 , 03:43 AM
is there a way to test how long it takes to run a piece of code in AHK? Set up stopwatches for major tasks and see what is taking the biggest part of that 1sec
SQL queries for poker app (AHK) Quote
02-16-2012 , 04:40 AM
Quote:
Originally Posted by Freakin
is there a way to test how long it takes to run a piece of code in AHK? Set up stopwatches for major tasks and see what is taking the biggest part of that 1sec
yeah I set up timers within the function to see that, I should have mentioned this in OP sorry.

The section that is taking the longest (>90% of the time) is this block:

Code:
	Loop
		If	DllCall("ReadFile", "Uint", hStdOutRd, "Uint", &sTemp, "Uint", nTemp, "UintP", nSize:=0, "Uint", 0)&&nSize
		{
		loopnum++
		;msgbox loopnum++
			NumPut(0,sTemp,nSize,"Uchar"), VarSetCapacity(sTemp,-1), sOutput.=sTemp
			If	bStream
				Loop
					{
					If	RegExMatch(sOutput, "[^\n]*\n", sTrim, nTrim)
						bStream+0 ? DllCall("WriteFile", "Uint", hCon, "Uint", &sTrim, "Uint", StrLen(sTrim), "UintP", 0, "Uint", 0) : %bStream%(sTrim), nTrim+=StrLen(sTrim)
					Else	Break
					}
		}
		Else	Break
thanks for replying!
SQL queries for poker app (AHK) Quote
02-16-2012 , 07:49 AM
I haven't used AHK in several years but if I had to guess I'd say the fact that you're using regex is something that could be killing performance. Speed is important in any app and I've been optimizing NoteCaddy's performance for around 2 years so I have made some discoveries most notably that even the most ghetto string parsing (substring, indexOf etc) is way faster than regex

Anyways it doesn't look like you need it based on your posts but in case you're not sure how to decipher what NC stores in the database, it's discussed here http://assaultwareforums.com/showthr...ighlight=split
SQL queries for poker app (AHK) Quote
02-16-2012 , 07:54 AM
Quote:
Originally Posted by SretiCentV
I haven't used AHK in several years but if I had to guess I'd say the fact that you're using regex is something that could be killing performance. Speed is important in any app and I've been optimizing NoteCaddy's performance for around 2 years so I have made some discoveries most notably that even the most ghetto string parsing (substring, indexOf etc) is way faster than regex

Anyways it doesn't look like you need it based on your posts but in case you're not sure how to decipher what NC stores in the database, it's discussed here http://assaultwareforums.com/showthr...ighlight=split
thanks one of my good friends actually posted that thread btw I'm thrillkill on your forum. I'm sure you'd be the guru at this kind of stuff considering how solid notecaddy is, keep up the great work!
SQL queries for poker app (AHK) Quote
02-16-2012 , 09:16 AM
Also, the block using regex is never really entered because I've got bStream set to 0. So its specifically something to do with the readfile dllcall I think....
SQL queries for poker app (AHK) Quote
02-17-2012 , 05:57 AM
If a reputable ahk guy knows how to help explain a solution/ give a solution but doesn't feel incentivised to help me then plz don't hesitate to pm me with a quote or something.
SQL queries for poker app (AHK) Quote
02-18-2012 , 12:09 AM
looks like calling varsetcapacity might not be needed inside the loop? that and numput are presumably what's taking up the all time. hard to guess without seeing it run and having stuff explained more!

to get around the clipboard issue I might suggest running my file-based psql function, but from a ramdisk (presumably we can still make those in windows!).
SQL queries for poker app (AHK) Quote
02-18-2012 , 09:47 AM
Quote:
Originally Posted by _dave_
looks like calling varsetcapacity might not be needed inside the loop? that and numput are presumably what's taking up the all time. hard to guess without seeing it run and having stuff explained more!
Hey dave,

I think my main problem is I didn't code the function, I just found it on the AHK forums and the creator is MIA. I quickly tried removing varsetcapacity and just calling it once before the loop but that made the function return empty strings.

Quote:
Originally Posted by _dave_
to get around the clipboard issue I might suggest running my file-based psql function, but from a ramdisk (presumably we can still make those in windows!).
thanks for the suggestion, I didn't even know what a ramdisk was but I've found a youtube tut

I followed links to try and find your script but the links were dead on the AHK forum, do you have a current link for it? cheers!
SQL queries for poker app (AHK) Quote
02-18-2012 , 01:09 PM
i would post your question on the ahk help forums or in the thread of the code youre using
SQL queries for poker app (AHK) Quote
02-18-2012 , 06:36 PM
Quote:
Originally Posted by greg nice
i would post your question on the ahk help forums or in the thread of the code youre using
hey greg

I did both before coming here, as well as asking in the ahk chatroom a few times. The creator seems MIA though unfortunately.
SQL queries for poker app (AHK) Quote
02-21-2012 , 04:51 AM
UPDATE: thanks to _dave_ for his idea on using a ramdisk + his psql function the speed has been reduced to 155-345 ms for 25million characters Really appreciate the suggestion dave, thanks!
SQL queries for poker app (AHK) Quote

      
m