Skip to content

createRDBESEstObject() uses a lot of memory #233

Description

@davidcurrie2001

The function createRDBESEstObject() uses a lot of memory - this can be a problem when you are dealing with large sets of input data. For example, importing the H1 data for the NANSEA RCG creates an RDBESDataOject of size 971 MB. Running createRDBESEstObject() on that data then creates an RDBESEstObject of size 9630.6 MB - 10x the size of the RDBESDataObject.

Activity

  1. davidcurrie2001 commented on May 9, 2025

    @davidcurrie2001
    ContributorAuthor

    Whilst looking at this function I re-wrote the part of the code which handles sub-sampling - the function now runs faster (but still uses a lot of memory).

  2. davidcurrie2001 commented on May 14, 2025

    @davidcurrie2001
    ContributorAuthor

    I have now changed character columns to factors in the RDBESEstObject. I also added a new parameter called "incDesignVariables" - if this is set to FALSE then the design variables aren't included in the RDBESEstObject. This significantly reduces the size of the RDBESEstObject. Example:

    myRawObject <- H1Example
    
    # Only use a subset of the test data
    myRawObject <- filterRDBESDataObject(myRawObject,c("DEstratumName"),c("DE_stratum1_H1","DE_stratum2_H1","DE_stratum3_H1"))
    myRawObject <- findAndKillOrphans(myRawObject, verbose = FALSE)
    
    myEstObject <- createRDBESEstObject(myRawObject,1, incDesignVariables = FALSE)
    
  3. davidcurrie2001 commented on May 14, 2025

    @davidcurrie2001
    ContributorAuthor

    Using the same H1 data as earlier the RDBESDataObject is still 917.2 MB. With the updated code, if I include the design variables the RDBESEstObject is 6,357.1 MB. If I don't include the design variables the RDBESEstObject is 3,359 MB.

  4. davidcurrie2001 commented on May 14, 2025

    @davidcurrie2001
    ContributorAuthor

    @Kasia-MIR - do you want to see if these changes help when you are trying to create estimation objects from large amounts of data? They are in the dev branch.

  5. Kasia-MIR commented on May 15, 2025

    @Kasia-MIR
    Contributor

    @davidcurrie2001 really thank you for your changes. Fantactic job. The change in time is from 4 hours to 10 minutes... This is a huge change!

  6. rix133 commented on Oct 15, 2025

    @rix133
    Contributor

    I think David has done enogh for now we can close this as merged in main #244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

2_preparationGenerating probabilities and Zero's, subsetting species9_needs_human_reviewPlease add more tests or review code some other way

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions