Skip to content

Optimize TableEntry Handling#11469

Merged
mitchute merged 12 commits into
developfrom
TableEntry
Jun 11, 2026
Merged

Optimize TableEntry Handling#11469
mitchute merged 12 commits into
developfrom
TableEntry

Conversation

@amirroth

Copy link
Copy Markdown
Collaborator

This PR optimizes TableEntry handling by storing entries in table-specific lists instead of a single global list. When printing out tables, each entry has to be traversed only once rather than once per table. Unique rows are also tracked on a per-table basis.

To enable this, SetPredefinedTables was moved to init_constant_state(). This broke a unit test which checked that the Standard 62.1 was not being printed out if sizing was not done. This logic was implemented by not initializing the table constants if Sizing was off, but that's not the way to do something like this. The unit test is partially disabled for now.

@amirroth amirroth added Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Mar 15, 2026
@amirroth amirroth added this to the EnergyPlus 26.1 milestone Mar 15, 2026

@amirroth amirroth left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple walk through.

s->pdchSHGSHtOtherRem = newPreDefColumn(state, s->pdstSHGSpkHt, "Opaque Surface Conduction and Other Heat Removal [W]");

// Standard62Report
if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't condition constant initialization based on flags. Initialize always and use the flags to condition display later.

// SUBROUTINE PARAMETER DEFINITIONS:
assert(columnIndex > 0 && columnIndex <= state.dataOutRptPredefined->numColumnTag);
auto &column = state.dataOutRptPredefined->columnTag(columnIndex);
auto &table = state.dataOutRptPredefined->subTable(column.indexSubTable);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store entries in table-specific lists.

auto &table = state.dataOutRptPredefined->subTable(column.indexSubTable);

for (int i = 1; i <= table.numEntries; ++i) {
if (table.entries(i).indexColumn == columnIndex && table.entries(i).objectName == objName) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search entries only from the appropriate table.

int numEntries;
int sizeEntries;

Array1D<TableEntryType> entries;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table-specific entry lists.


for (auto &currentStyle : ort->tabularReportPasses) {

// loop through the entries and associate them with the subtable and create

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will do this on a per-table basis below.

}
}

int curNumRows = numUniqueObjectNames;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number of rows equals number of unique objects.

}

// determine what row the current entry is in
int const rowCurrent = entry.uniqueObjName;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation has changed, that is all.


TEST_F(EnergyPlusFixture, OutputReportTabularTest_PredefinedTableRowMatchingTest)
{

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being called by init_constant_state().


void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
{
OutputReportPredefined::SetPredefinedTables(state);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call SetPredefinedTables() here.

// Do this some other way, whether or not a report is used should not depend on whether or not it is defined

GetInputOutputTableSummaryReports(*state);
// auto &reportNameArray = state->dataOutRptPredefined->reportName;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disable this part of the unit test (for now?). Maybe do this via an #ifdef DISABLED.

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit d667b96

Regression Summary
  • Audit: 814
  • Table String Diffs: 11

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit d667b96

Regression Summary
  • Audit: 810
  • Table String Diffs: 11

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 5a476ca

Regression Summary
  • Audit: 810

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 5a476ca

Regression Summary
  • Audit: 814

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 2caf4af

Regression Summary
  • Audit: 810

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 2caf4af

Regression Summary
  • Audit: 814

@mitchute

Copy link
Copy Markdown
Collaborator

I've tested this locally and am seeing that for files with no system sizing (ASIHPMixedTank.idf, for example), the 62.1 table entries appear in the .htm file, but they are blank. Whereas in the baseline branch, they do not appear at all, which I think is consistent with what you described regarding the unit test. Hence some of the very large .audit file diffs.

  sizeReportName=         100
- numReportName=          18
+ numReportName=          19
  sizeSubTable=         200
- numSubTable=         105
+ numSubTable=         113
  sizeColumnTag=        1600
- numColumnTag=         968
- sizeTableEntry=        6400
+ numColumnTag=        1053
+ sizeTableEntry=        7900
  numTableEntry=        3248

For files with system sizing (5ZoneAirCooledConvCoeff.idf), I am still seeing very large .audit file diffs, but the .htm files show no numerical diffs (though the entries are reordered in some cases).

-  sizeTableEntry=        6400
+  sizeTableEntry=        11200

@amirroth

amirroth commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator Author

I've tested this locally and am seeing that for files with no system sizing (ASIHPMixedTank.idf, for example), the 62.1 table entries appear in the .htm file, but they are blank. Whereas in the baseline branch, they do not appear at all, which I think is consistent with what you described regarding the unit test. Hence some of the very large .audit file diffs.

  sizeReportName=         100
- numReportName=          18
+ numReportName=          19
  sizeSubTable=         200
- numSubTable=         105
+ numSubTable=         113
  sizeColumnTag=        1600
- numColumnTag=         968
- sizeTableEntry=        6400
+ numColumnTag=        1053
+ sizeTableEntry=        7900
  numTableEntry=        3248

For files with system sizing (5ZoneAirCooledConvCoeff.idf), I am still seeing very large .audit file diffs, but the .htm files show no numerical diffs (though the entries are reordered in some cases).

-  sizeTableEntry=        6400
+  sizeTableEntry=        11200

The audit files diffs don't really matter. Especially the ones having to do with sizes of lists as opposed to number of entries. The blank table is a problem, but it needs a different solution than what was previously used. I can try to come up with something, or maybe @JasonGlazer has an idea.

@rraustad

rraustad commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

I've tested this locally and am seeing that for files with no system sizing (ASIHPMixedTank.idf, for example), the 62.1 table
entries appear in the .htm file, but they are blank. Whereas in the baseline branch, they do not appear at all, which I think
is consistent with what you described regarding the unit test. Hence some of the very large .audit file diffs.

See old and new line 1450 of OutputReportPredefined.cc, these tables are now created regardless if sizing is selected.

    if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing) {  

@amirroth amirroth marked this pull request as draft March 30, 2026 13:45
@amirroth amirroth self-assigned this Mar 30, 2026
s->pdchS62shdEvz = newPreDefColumn(state, s->pdstS62sysHeatDes, "Zone Ventilation Efficiency - Evz-min");
}

// if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the reason the tables are now present and blank.

@mitchute

Copy link
Copy Markdown
Collaborator

This brings back the missing tables, but there's one large math diff I haven't gotten to the bottom of. If you'd prefer something else, we can revert the last commit.

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit a8b5ff9

Regression Summary
  • Audit: 815

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit a8b5ff9

Regression Summary
  • Audit: 811

@nrel-bot-2c

Copy link
Copy Markdown

@amirroth it has been 28 days since this pull request was last updated.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit cf61f75

Regression Summary
  • Audit: 817
  • ESO Small Diffs: 708
  • Table Small Diffs: 393
  • MTR Small Diffs: 525
  • Table String Diffs: 177
  • EIO: 397
  • JSON Small Diffs: 2
  • ZSZ Small Diffs: 71
  • Table Big Diffs: 35
  • ERR: 15
  • MTR Big Diffs: 2
  • EDD: 4
  • ESO Big Diffs: 10
  • SSZ Small Diffs: 13
  • JSON Big Diffs: 2

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit cf61f75

Regression Summary
  • Audit: 813

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 25f1cc0

Regression Summary
  • Audit: 817
  • ESO Small Diffs: 708
  • Table Small Diffs: 393
  • MTR Small Diffs: 525
  • Table String Diffs: 177
  • EIO: 397
  • JSON Small Diffs: 2
  • ZSZ Small Diffs: 71
  • Table Big Diffs: 35
  • ERR: 15
  • MTR Big Diffs: 2
  • EDD: 4
  • ESO Big Diffs: 10
  • SSZ Small Diffs: 13
  • JSON Big Diffs: 2

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 0c20512

Regression Summary
  • Audit: 817
  • ESO Small Diffs: 708
  • Table Small Diffs: 393
  • MTR Small Diffs: 525
  • Table String Diffs: 177
  • EIO: 397
  • JSON Small Diffs: 2
  • ZSZ Small Diffs: 71
  • Table Big Diffs: 35
  • ERR: 15
  • MTR Big Diffs: 2
  • EDD: 4
  • ESO Big Diffs: 10
  • SSZ Small Diffs: 13
  • JSON Big Diffs: 2

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 25f1cc0

Regression Summary
  • Audit: 813

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 0c20512

Regression Summary
  • Audit: 813

@mitchute mitchute marked this pull request as ready for review June 9, 2026 14:22
@mitchute

mitchute commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

I believe this is ready for review. Lots of .aud diffs, but I'm not sure if we care about that.

This from 1ZoneUncontrolled_DDChanges.idf

Screenshot 2026-06-09 at 8 21 58 AM

Thoughts?

@JasonGlazer pointed out that we are seeing some performance benefits.

Screenshot 2026-06-09 at 8 24 21 AM

@rraustad rraustad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only diff is audit files and those diffs have been explained. I am inclined to merge.

@mitchute mitchute left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few final comments. I think this can merge soon if tests pass and I don't hear from anyone else.

Comment on lines -1849 to -1850
SetPredefinedTables(*state);

@mitchute mitchute Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init_constant_state() was being called by the test fixture, so it's no longer necessary to call this explicitly in each test.

Comment on lines +91 to +100
void clearDXCoolingCoilStandardRatingTables(EnergyPlusData &state)
{
auto &orp = *state.dataOutRptPredefined;
for (int subTableIndex : {orp.pdstDXCoolCoil, orp.pdstDXCoolCoil_2023}) {
auto &subTable = orp.subTable(subTableIndex);
subTable.entries.deallocate();
subTable.numEntries = 0;
subTable.sizeEntries = 0;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test helper here, since there are two tests that had previously called SetPredefinedTables multiple times to set/check/reset table values.

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 03006cc

Regression Summary
  • Audit: 814

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 03006cc

Regression Summary
  • Audit: 818

@mitchute

Copy link
Copy Markdown
Collaborator

Thanks @amirroth and @rraustad. Merging.

@mitchute mitchute merged commit f52918e into develop Jun 11, 2026
8 of 13 checks passed
@mitchute mitchute deleted the TableEntry branch June 11, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NotIDDChange Code does not impact IDD (can be merged after IO freeze) Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants