commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <>
Subject [jira] [Updated] (MATH-1155) Speedup initialization of WellXXX rngs
Date Mon, 23 Feb 2015 13:12:11 GMT


Thomas Neidhart updated MATH-1155:
    Attachment: MATH-1155.patch

Attached a patch to create static index tables for each WELL class random number generator.

Instead of having protected member fields in the AbstractWell base class, which need to be
calculated for every instance, there is now a static IndexTable instance for each WELL class,
containing the previous protected fields.

I was first thinking of applying a Initialization on Demand Holder Idiom to initialize the
table only when the random generator is used, but the table initialization is not that costly,
only when it is repeated again and again for each instance.

The IndexTable class is now package-private inside the AbstractWell class, which means users
creating their own WELL implementation will not be able to use them, but I wonder if somebody
did so? If needed, we can make it protected to support that.

> Speedup initialization of WellXXX rngs
> --------------------------------------
>                 Key: MATH-1155
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.3
>            Reporter: Thomas Neidhart
>             Fix For: 4.0
>         Attachments: MATH-1155.patch
> As identified in MATH-1154, initialization of the WellXXX rngs is quite costly as some
internal arrays have to be computed.
> Most of these initializations are specific to the type of rng, e.g. Well19937a and will
not change afterwards, thus could be initialized in a static way.
> Due to implementation details, i.e. the relevant fields are declared protected in the
base class AbstractWell, such a change would not be backwards compatible and will have to
be postponed to 4.0

This message was sent by Atlassian JIRA

View raw message