×

To be able to write in the forum you need to authenticate. Meanwhile it's read-only.

Change History

Once a checker request has been fulfilled and the challenge owner (or checker requester) is satisfied the thread should be moved here by a moderator. Please allow some time before moving the thread, to allow feedback from the requester.

Message: Re: Log all geocaches hidden by 5 geocachers

Changed By: pieterix
Change Date: January 10, 2019 10:39AM

Re: Log all geocaches hidden by 5 geocachers
Oddly enough, Awgnld sometimes completes in as little as 2.2 seconds and sometimes it exceeds the time, eg.

Awgnld fulfills challenge ? according to https://project-gc.com/Challenges//39392
Script executed in 2.2 seconds. Peak memory usage: 50,280 kB

Awgnld has found all active caches for 51 cache owners (needed: 5)
...

Awgnld fulfills challenge ? according to https://project-gc.com/Challenges//39392
Script executed in 60 seconds. Peak memory usage: 28,583 kB

Had to abort due to lack of CPU time, so this solution might not be the correct one.
Awgnld has found all active caches for 10 cache owners (needed: 5)
...

PGC.GetCPUUsage() isn't documented and didn't have the desired effect, so I opted for:
local deadline = os.time()+env.maxExecutionTime-5
along with:
if (os.time() > deadline) then
bailed = true
break
end

Oddly enough with 5 seconds deducted from deadline, it still runs to 60 seconds, so I've deducted 10 seconds now.

Edit: never mind, I was being stupid. Didn't initialise my deadline value early enough in the script.

Original Message

Author: pieterix
Date: January 10, 2019 10:11AM

Re: Log all geocaches hidden by 5 geocachers
Oddly enough, Awgnld sometimes completes in as little as 2.2 seconds and sometimes it exceeds the time, eg.

Awgnld fulfills challenge ? according to https://project-gc.com/Challenges//39392
Script executed in 2.2 seconds. Peak memory usage: 50,280 kB

Awgnld has found all active caches for 51 cache owners (needed: 5)
...

Awgnld fulfills challenge ? according to https://project-gc.com/Challenges//39392
Script executed in 60 seconds. Peak memory usage: 28,583 kB

Had to abort due to lack of CPU time, so this solution might not be the correct one.
Awgnld has found all active caches for 10 cache owners (needed: 5)
...

PGC.GetCPUUsage() isn't documented and didn't have the desired effect, so I opted for:
local deadline = os.time()+env.maxExecutionTime-5
along with:
if (os.time() > deadline) then
bailed = true
break
end

Oddly enough with 5 seconds deducted from deadline, it still runs to 60 seconds, so I've deducted 10 seconds now.