Jump to content
Eternal Lands Official Forums
Grum

Speeding up map load

Recommended Posts

I have just pushed the changes into master, with the relevant bits protected by #ifdef FASTER_MAP_LOAD.

 

Very nice.. map ,loading was not 'slow' before but noticeably faster now ... ty

Share this post


Link to post
Share on other sites

I compiled with some debug code to get the time for a map change.

Here the results for my system switching from ws to dp and back and average over 10 map changes:

 

without FASTER_MAP_LOAD

to DP: 432 ms

to WS: 1413 ms

with FASTER_MAP_LOAD

to DP: 311 ms

to WS: 580 ms

as you can see there is a very visible change for complex maps.

 

After login loading times can be times slower but once I visited some maps and the texture cache is filled, most map changes go in less than a second.

 

 

btw: if you can't get a dev client start your client with --log_level=info or --log_level=error to speed up map changes by 50-200 ms

Share this post


Link to post
Share on other sites

These changes are working very nicely. Any objections to enabled them by default in git? Just the make file FEATURE enabled by define that is. A minor point but why would we not?

Share this post


Link to post
Share on other sites

These changes are working very nicely. Any objections to enabled them by default in git? Just the make file FEATURE enabled by define that is. A minor point but why would we not?

No objections from me :P

 

I've tried to be rather conservative, so enabling it by default should not cause regressions. The only pain point I can see at this moment is that the progress bar update is not as smooth as it used to be. I personally don't care (I've got the whole thing disabled anyway), but others might.

Share this post


Link to post
Share on other sites

I have small problem with this new update. I can't use my key shortcuts after compiling client with (enabled) FEATURES += FASTER_MAP_LOAD. I have edited key.ini file and use 1, 2, 3 etc. for items instead of ctrl 1, ctrl 2 etc.

So only default keys work with latest git update. When I compile client again with (disabled) #FEATURES += FASTER_MAP_LOAD my keys work again.

Share this post


Link to post
Share on other sites

I have small problem with this new update. I can't use my key shortcuts after compiling client with (enabled) FEATURES += FASTER_MAP_LOAD. I have edited key.ini file and use 1, 2, 3 etc. for items instead of ctrl 1, ctrl 2 etc.

So only default keys work with latest git update. When I compile client again with (disabled) #FEATURES += FASTER_MAP_LOAD my keys work again.

The key changes probably shouldn't have gone in under FASTER_MAP_LOAD, I'll create a new #define for that. That being said, as usual, it Works For Me (though entering numbers is now a bit problematic :P). The new code assumes that all keys are defined on different lines, whereas the old code wouldn't, so that's a change. What operating system/newline convention are you using?

 

If you can't get it to work, please send me a forum PM for my email address to send me your key.ini file, so that I can take a look at what's wrong.

Share this post


Link to post
Share on other sites

I'm using Linux.

And thats my key.ini file: http://pastebin.com/7U2yRpYp

Hmm, strange. I'm also using Linux, and the file you've posted works fine (though it has windows line endings). Can you please apply the patch below, and post the output here (it writes to terminal, I'm too lazy to look for the debug options right now):

diff --git a/keys.c b/keys.c
index a5f3bab..cb025dc 100644
--- a/keys.c
+++ b/keys.c
@@ -323,6 +323,31 @@ static Uint16 get_key_code(const char *key)
}

#ifdef FASTER_STARTUP
+static const char* escape(const char* line)
+{
+	static char buf[1024];
+	char *buf_end = buf + (sizeof(buf)-1);
+	const char *src;
+	char *dest;
+	int i, j;
+
+	src = line;
+	dest = buf;
+	while (*src && dest < buf_end)
+	{
+		if (isgraph(*src))
+			*dest++ = *src++;
+		else
+			dest += snprintf(dest, buf_end-dest, "\\x%02x", *src++);
+	}
+	if (dest >= buf_end)
+		*buf_end = '\0';
+	else
+		*dest = '\0';
+
+	return buf;
+}
+
static void parse_key_line(const char *line)
{
	char kstr[100], t1[100], t2[100], t3[100], t4[100];
@@ -330,6 +355,7 @@ static void parse_key_line(const char *line)
	int nkey = sscanf(line, " #K_%99s = %99s %99s %99s %99s", kstr,
		t1, t2, t3, t4);

+	printf("nkey = %d, line = \"%s\"\n", nkey, escape(line));
	if (nkey <= 1)
		return;

 

Thanks!

 

EDIT: BTW, if you've pulled from git, please enable FASTER_STARTUP in make.conf.

Edited by Grum

Share this post


Link to post
Share on other sites

[12:35:51] krl@ubuntu-pc:~/elc$ patch < patch.diff 
patching file keys.c
Hunk #1 succeeded at 323 with fuzz 1.
Hunk #2 FAILED at 355.
1 out of 2 hunks FAILED -- saving rejects to file keys.c.rej
[12:35:56] krl@ubuntu-pc:~/elc$ cat keys.c.rej 
--- keys.c
+++ keys.c
@@ -355,6 +380,7 @@
       int nkey = sscanf(line, " #K_%99s = %99s %99s %99s %99s", kstr,
               t1, t2, t3, t4);

+       printf("nkey = %d, line = \"%s\"\n", nkey, escape(line));
       if (nkey <= 1)
               return;

Now, that I pulled from git and compiled it before patching, everything works fine.

So if the patching failed, no point compiling with FASTER_STARTUP right?

Share this post


Link to post
Share on other sites

[12:35:51] krl@ubuntu-pc:~/elc$ patch < patch.diff 
patching file keys.c
Hunk #1 succeeded at 323 with fuzz 1.
Hunk #2 FAILED at 355.
1 out of 2 hunks FAILED -- saving rejects to file keys.c.rej

Did you patch before or after pulling? The patch is based on the most recent git, so may not apply to older versions.

Now, that I pulled from git and compiled it before patching, everything works fine.

So if the patching failed, no point compiling with FASTER_STARTUP right?

By default, FASTER_STARTUP is disabled, so if you did not enable it, the old version of the code will be used. If everything works with FASTER_STARTUP, all's fine. If it doesn't, I'd like to find out why.

Share this post


Link to post
Share on other sites

Did you patch before or after pulling? The patch is based on the most recent git, so may not apply to older versions.

I patched after pulling.

Although patching failed, I compiled it with FASTER_STARTUP and keys won't work again.

Share this post


Link to post
Share on other sites

I patched after pulling.

Looks like there are other changes in your copy of keys.c then. Please try to

git checkout keys.c

and apply the patch after that.

Share this post


Link to post
Share on other sites

How are you copy/pasting the patch? If you copy/paste direct from the post then the formatting (space etc) is all messed up and usually breaks the patch. Instead, click the reply button on the post and copy/paste the patch section from the editor view. That should work OK.

Share this post


Link to post
Share on other sites

How are you copy/pasting the patch? If you copy/paste direct from the post then the formatting (space etc) is all messed up and usually breaks the patch. Instead, click the reply button on the post and copy/paste the patch section from the editor view. That should work OK.

Good advice, I figured the formatting was ok since the first hunk succeeded, but I may be wrong. krlc, could you please follow bluap's suggestion? Thanks.

Share this post


Link to post
Share on other sites

Did that too, nothing has changed.

I think I'm doing everything right, even removed whole folder and cloned from git again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×