logo separator

[mkgmap-dev] max-jobs patch

From Mike Baggaley mike at tvage.co.uk on Mon Feb 19 11:29:33 GMT 2018

Hi Gerd, 

I would prefer removing the static modifier as you suggest, but accessing
the variable via mm.maxJobs rather than mm.getMaxJobs(), and having no
getter implementation. However, I am happy with using the getter if you
prefer it.

I think getters and setters in mkgmap have been overused. I would only use
getters and/or setters for a class that wants to allow another class to
access some internal variable, but also wants to prevent it from changing it
directly. If a class implements get and set as direct copies from/to the
internal variable, all it is doing is adding a small overhead each time the
variable is accessed with no obvious benefit. I would primarily use them
where either the get or set does more than just copy (e.g. it needs to
recalculate something when the value is changed) or there is a likelihood
that another class based on it would need to override the interface.
However, my background is C++ and C#, not Java, so I may be missing some
subtlety.

Cheers,
Mike

-----Original Message-----
From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com] 
Sent: 19 February 2018 09:12
To: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk>
Subject: Re: [mkgmap-dev] max-jobs patch

Hi Mike,

sorry for the late response.
I've just recognized the static modifier in maxjobs. I think it is better to
use a getter instead, see
attached modifed version of the patch. If you agree, I'll commit this
version.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Mike
Baggaley <mike at tvage.co.uk>
Gesendet: Freitag, 16. Februar 2018 17:18:15
An: 'Development list for mkgmap'
Betreff: Re: [mkgmap-dev] max-jobs patch

Hi Gerd, I misread the --max-jobs with no value functionality. Please find
attached a revised patch that does function that way when the max-jobs
option is specified with no value.

Cheers,
Mike

-----Original Message-----
From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com]
Sent: 16 February 2018 10:42
To: Mike Baggaley <mike at tvage.co.uk>
Subject: AW: [mkgmap-dev] max-jobs patch

Hi Mike,

without the patch the option --max-jos means: use as many threads as cores.
Since mkgmap is normally very silent I would not print an information that
just confirms that anything is normal.

My personal preference would be to print much more information about
performance, but my understanding is that
the mkgmap users are happy with the silent behaviour.

BTW: I'd also print a message that tells the user how to activate logging if
it is not already activated.

Gerd

________________________________________
Von: Mike Baggaley <mike at tvage.co.uk>
Gesendet: Freitag, 16. Februar 2018 11:20:03
An: 'Gerd Petermann'
Betreff: RE: [mkgmap-dev] max-jobs patch

Hi Gerd, as the functionality of --max-jobs without a value is the same as
not specifying the parameter (i.e. it is the default), it seems to me to be
better for them to function the same. If you have specified --max-jobs
without a value, why would you not want to know how many threads had been
assigned?

Regards,
Mike

-----Original Message-----
From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com]
Sent: 15 February 2018 08:54
To: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk>
Subject: Re: [mkgmap-dev] max-jobs patch

Hi Mike,

looks good to me. I am just not sure about the new stdout message
"Setting max-jobs to 4"
It appears when --max-jobs is not used (ok), but also when it is used
without a parameter.
In  the latter case I would only print this message if the number of CPU
cores is higher.

Gerd


________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Gerd
Petermann <gpetermann_muenchen at hotmail.com>
Gesendet: Mittwoch, 14. Februar 2018 19:38:06
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] max-jobs patch

Hi Mike,

okay, I'll try it tomorrow.

Gerd


________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Mike
Baggaley <mike at tvage.co.uk>
Gesendet: Mittwoch, 14. Februar 2018 18:30:28
An: 'Steve Ratcliffe'; mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] max-jobs patch

I tried renaming the java library to force a failure and got a java error
"Error occurred during initialization of VM" before any mkgmap code was
executed, so to be on the safe side, I have removed that code and amended
the message in the attached patch.

Regards,
Mike

-----Original Message-----
From: Steve Ratcliffe [mailto:steve at parabola.me.uk]
Sent: 13 February 2018 23:01
To: mkgmap-dev at lists.mkgmap.org.uk
Subject: Re: [mkgmap-dev] max-jobs patch

Hi Mike

> I could take out that bit of code, which is just determining how
> much physical memory is installed, so that mkgmap won't suggest that the
> user increases the available heap too much. It isn't used in determining a
> value for maxjobs.

Since it is just used for an informational message, you could just
surround it with a try/catch block.  Then if it doesn't
exist on a particular it isn't a problem when using the
downloaded pre-compiled distribution.

Of course it would fail to compile on such a platform, but then
hopefully someone will let us know and we can decide what to do then.

Steve

_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev





More information about the mkgmap-dev mailing list