Bug - Fixed Performance issues

That didn't work.

There is zero chance that I will ever set Chrome as my default browser.

If somebody can tell me what to type in the Browser field of Preferences/External Programs to get Google Chrome on a Mac, I'm all ears.

Thanks.

Yes, I am using Chrome on a mac:

-b com.google.Chrome
 

Bale

Minion
Perhaps those images should be relocated to the /data directory if they mess with your schema. I can do that. I just left them there because that's where the original author of ChiIT put them before I took over.

I tried relocating the images to /data and it did not work. In retrospect I suppose I should have expected that. Is there some trick to using images in the data directory or is it simply impossible?
 

Veracity

Developer
Staff member
OK, that worked. Thanks.

I started up Chrome and navigated to various pages - terrarium, inventory. I did notice some broken links - and when I looked at my trace log, I saw that we had fetched the files and the browser later asked for those same files with "If-Modified-Since". KoLmafia send bak "Not Modified", on the assumption that if we had it cached, the browser must have had the file. Apparently not.

I didn't have a full debug log, so I don't know what Modified-Since date it was asking for.

Revision 12641 actually compares the "If-Modified-Since" date to the the lastModified date of the file. If the file is newer, it sends the file (again). Otherwise, it says Not Modified.

I was unable to reproduce the problem after doing this. Actually, I was unable to reproduce the problem BEFORE doing this; only the first try actually had any broken images. So, I don't know if this fixes your problem, but it's the only suspect behavior I was able to observe.
 

Veracity

Developer
Staff member
I tried relocating the images to /data and it did not work. In retrospect I suppose I should have expected that. Is there some trick to using images in the data directory or is it simply impossible?
Images are cached only in /images or a subdirectory.

It's fine with me if there is one designated directory for relay overrides to store images in which we will not look at on a "cache clear", however that is done. images/relay seems fine.
 

Bale

Minion
Shall I move ChIT's images to /images/relay then, in anticipation of that becoming a thing?
 

Veracity

Developer
Staff member
Sure. If KoL ever makes the images.kingdomofloathing.com/relay directory, there will be potential conflicts, but I seriously doubt that they will do that.
 

Bale

Minion
I can make it even less likely by using the directory, images/relayimages. (More complicated names are less likely.) Your input on what the standard should be before I make a change (which curiously is actually a reversion).
 

Tussosedan

New member
Currently investigating my current performance, using the new debug trace, and seeing that any time I get an item or finish a fight the display in the relay browser is really slow, but the rest of the time the performance isn't too bad. I've had Mafia open most of the day, but have only run 87 turns, 40 automatically, and the rest in the browser. Seems to have got much slower in the last few hours where I've not been playing at all. Currently taking around 10 seconds from getting the data from KoL to sending it to the browser.

Are you using Java 6 or 7?
I had a similar issue, and moving back to Java 6 seems to have fixed it for me.
 

Darzil

Developer
Are you using Java 6 or 7?
I had a similar issue, and moving back to Java 6 seems to have fixed it for me.

I'm using 7. I might try moving back to 6 for a day to see if the issue goes away. If it did I'd then know I was looking for a Java issue rather than a Kolmafia one.
 

Fluxxdog

Active member
I can make it even less likely by using the directory, images/relayimages. (More complicated names are less likely.) Your input on what the standard should be before I make a change (which curiously is actually a reversion).
I'm looking at your code before I updated for the day:
Code:
string imagePath = "/images/chit/";
If you have control over where the images go, why not /relay/images/chit ? That seems a more logical place. Just a suggestion.
 

Bale

Minion
I'm looking at your code before I updated for the day:
Code:
string imagePath = "/images/chit/";
If you have control over where the images go, why not /relay/images/chit ? That seems a more logical place. Just a suggestion.

I agree, but if you look up a couple of posts to #44 you'll see that mafia can only use images if they are in the /images directory.
 

Fluxxdog

Active member
Ah, I thought she was just talking about cached images, not all images. Odd. If a call is made for anything without an http(s):// why should it treat it like it was cached? It sounds like anything that looks for "/images/whatever/" will automatically look in "http://images.kingdomofloathing.com/whatever/" if caching is disabled. Am I right in my interpretation?
 

Veracity

Developer
Staff member
It sounds like anything that looks for "/images/whatever/" will automatically look in "http://images.kingdomofloathing.com/whatever/" if caching is disabled. Am I right in my interpretation?
No. If a page asks for something in /images, KoLmafia will always look there, whether or not caching is enabled. It might copy the image from one of it's built-in images - the green porko arrow, the up arrow in the charpane, whatever - or, it might go to images.kingdomofloathing.com to fetch it. Or it might already be there from a previous load.

The only thing turning on or off caching does is determine if KoLmafia munges links in pages returned by KoL from http://images.kingdomofloathing.com/whatever to /images/whatever. It has no effect on images that are alread in /images.

It is safe to clear everything in /images, since if KoLmafia is asked to serve something there, it will copy it from it's built-in images if it is not there - except for custom images added by scripts, like chit. I believe that /images is the only built-in os-independant way for a relay script to put in a link to a local file into a page.

I like /images/relayimages/whatever as a "safe" directory of relay script images that KoLmafia will not clear by itself, when I add "cache clear" or whatever.
 
So in version 12644 in Chrome I was playing with "Empty the Cache" since the beginning of time. It seems that every time I did this, and then reloaded a page, I would see broken images.
(using the "Cache KoL images to conserve bandwidth") preference. So far the only way to fix this seems to be to both empty the cache in chrome again, quit mafia, empty the image directory
(of everything except "chit") and then restart mafia and the relay browser. Even some of the chit images where broken after I cleared the cache in Chrome (using this test).

Edit: well I was able to quit kolmafia and restart, and a lot of the images were fixed. I also noticed a "delay" where if I loaded a page, some images would be broken, and
then if I reloaded, the images would be fixed.

Edit Edit: I also noticed that instead of wiping out images in the image directory, if you instead touch each file (updating the timestamp). In macosx you'd have
to do this in the console:

find . -name \* -exec touch {} \;

Once the timestamps are updated, sometimes that fixes broken images.

Also, sometimes if you open a broken image in a new tab you can see it.
 
Last edited:

Veracity

Developer
Staff member
I also noticed that instead of wiping out images in the image directory, if you instead touch each file (updating the timestamp).
Bad idea. The "lastModified" dates are explicitly and intentionally set to the dates that KoL sends us.

In any case, I suggest that you get revision 12646, actually clear your image cache, and try again. That revision will not erroneously return "Not Modified" to requests that weren't asked for "If-Modified-Since". I forgot to initialize an instance variable and when the instance was reused, it had the previous request's value...
 

zarqon

Well-known member
I was about to post that I was having a lot of problems with images and linked scripts (.js and CSS) not loading, but today's experience is very different from yesterday's -- it's all working. Thanks Veracity!
 

Fluxxdog

Active member
Just for record, with equipment in every slot, I did this:
Code:
> debug on

> outfit birthday suit

Taking off everything...
Everything removed.

> debug off

> debug trace off
Logs attached. When I hit enter after the outfit command, it took about 5 seconds before the CLI went back to green. Normally the CLI just goes grey for a spilt second. The trace log show response and return times are from .1 to .2 seconds. Since no images are called, maybe someone can see something else?
 

Attachments

  • DEBUG_20130918.txt
    9.7 KB · Views: 46
  • TRACE_20130918.txt
    1 KB · Views: 20

Darzil

Developer
Interestingly, my performance issues that looked to be related to processing rather than web comms, and got worse through the day, seem to be gone with Java 6 rather than Java 7.
 
Top