Feature - Implemented time function

Fails based on that it still hits the server on each request... does a visit_url on every call. :(

I am using it once per logon, to debug a problem I am having with my store budget
hopefully can turn it off in a couple of weeks.

Dave
 
I mean, it doesn't answer the original question... the goal was getting the information without a server hit. :D Parsing rollover time when you hit the server? Common. Knowing rollover time without server hits? More difficult. Especially without the code-patch.
 
How's this for Murphy: I finally get what I want, but now the code executes so fast (no waiting for the page to return) that the script ramps up my CPU to 50% and burns my lap. Yay. I don't use it once or twice per logon. I use it constantly. It -is- my waitstate.

On the other hand, I'd have no problem using wait() if there were some way to keep it from clogging up my gCLI. Like.. silentwait() would be badass.
 
Not without some major tweaking, though you might be able to do it by doing a visit_url to a local page, especially if that page just runs a 1 second javascript delay or something like that...
 
That's brilliant. visit_url without a path assumes KoL... if I say "timedelay.php" will it first look in relay for a timedelay.ash?
 
Should, I think. Not sure if you can run it against wait, or if that will still be displayed... checking now. Well, yes and no... manually launching a relay override causes both the delay, and the logging. Launching it using visit_url causes no delay, so that makes it not useful there.

Could probably make it work if you figured out the javascript language bits for it... Probably.really not sure. If you pulled it into a string, it should work, as long as it actually properly delays...
 
Yeah, I realized this morning that visit_url wouldn't (well, shouldn't) actually execute the any javascript found. Not sure what you mean about "figured out the javascript language bits for it"... is there an ash command to execute Javascript similar to the cli command to execute ash?
 
New version of the gametime_to_int function, this time without random bits of monster level code from when I was trying to piece together... who knows what.
 

Attachments

New version of the gametime_to_int function, this time without random bits of monster level code from when I was trying to piece together... who knows what.

Any specific reason this wasn't implemented before? I kind of like the idea but don't want to commit over the objections of others.
 
Lack of general interest, I believe? Only people that used it were myself and bordemstirs, and nobody else actually expressed interest in having it in the source. Its usage in timing and other such things makes it more appealing now though.
 
Lack of general interest, I believe? Only people that used it were myself and bordemstirs, and nobody else actually expressed interest in having it in the source. Its usage in timing and other such things makes it more appealing now though.

I just used it for a minor profileing experiment! :)
 
hmm... no one told me about that command, seriously i've been using kolmafia for over 2 years and I don't know it all!
 
Which is great if you're testing total script execution time... not so great if you're trying to test execution time for 4 different things in the same script. :D

Edit: And yeah, I ran across profile when I was trying to figure out what all the commands did to find... something or another. Never did find what I was looking for, but since I can't remember what it was, it obviously wasn't too important.
 
It does also show how much time is spent in individual functions, yes? No self-respecting profiler would do otherwise, I'd hope.
 
Yes... but you can't run it against an inline ash script. Though if you're willing to save it to a file, it's great. :)

Edit: Well, sort of great. Here is matt.chugg's speed script saved as an ash script named speed.ash with the only difference being that I turned print into print_html so it doesn't go in my logs, run through profile.
> profile speed

Test 1
1000 Iterations full loop (type="food" took 16945ms
Test 2
1000 Iterations (full loop, fullness > 0) took 19374ms
Test 3
1000 Iterations (fullness.text) took 7378ms
Test 4
1000 Iterations (fullness.text(pre loaded)) took 1631ms
Test 1
1000 Iterations full loop (type="food" took 16491ms
Test 2
1000 Iterations (full loop, fullness > 0) took 27369ms
Test 3
1000 Iterations (fullness.text) took 10532ms
Test 4
1000 Iterations (fullness.text(pre loaded)) took 1788ms
Test 1
1000 Iterations full loop (type="food" took 19248ms
Test 2
1000 Iterations (full loop, fullness > 0) took 22166ms
Test 3
1000 Iterations (fullness.text) took 7651ms
Test 4
1000 Iterations (fullness.text(pre loaded)) took 2371ms


Count Total Net Name (sorted by total time)
1 152.995 130.76 toplevel
3003 18.859 18.859 file_to_map(string, aggregate)
15027000 3.35 3.35 item_type(item)
24 0.024 0.024 print_html(string)
24 0.0020 0.0020 gametime_to_int()

Count Total Net Name (sorted by net time)
1 152.995 130.76 toplevel
3003 18.859 18.859 file_to_map(string, aggregate)
15027000 3.35 3.35 item_type(item)
24 0.024 0.024 print_html(string)
24 0.0020 0.0020 gametime_to_int()
Useful? Sort of. Does it say what spent time where? Not really. If we turned each test into its own function, would it have been more useful? Probably. :)
 
Last edited:
r9605. if a helpful soul would update the wiki that would be appreciated.

curiously my system seems much slower on the test than several other people's...
 
Back
Top