Skip to content

Commit 27e51be

Browse files
Optimize opening arrays. (#5651)
Fixed some performance bottlenecks identified during profiling, as part of CORE-383. --- TYPE: IMPROVEMENT DESC: Improved performance when opening arrays
1 parent 28e4986 commit 27e51be

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

tiledb/sm/array/array_directory.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,14 +1035,14 @@ ArrayDirectory::compute_uris_to_vacuum(
10351035
if (timestamps_overlap(
10361036
fragment_timestamp_range,
10371037
!full_overlap_only &&
1038-
consolidation_with_timestamps_supported(uri))) {
1038+
consolidation_with_timestamps_supported(fragment_id))) {
10391039
overlapping_vac_file_bitmap[i] = 1;
10401040
}
10411041
} else {
10421042
if (!timestamps_overlap(
10431043
fragment_timestamp_range,
10441044
!full_overlap_only &&
1045-
consolidation_with_timestamps_supported(uri))) {
1045+
consolidation_with_timestamps_supported(fragment_id))) {
10461046
non_vac_uri_bitmap[i] = 1;
10471047
}
10481048
}
@@ -1167,7 +1167,7 @@ ArrayDirectory::compute_filtered_uris(
11671167
if (timestamps_overlap(
11681168
fragment_timestamp_ranges[i],
11691169
!full_overlap_only &&
1170-
consolidation_with_timestamps_supported(uri))) {
1170+
consolidation_with_timestamps_supported(fragment_id))) {
11711171
overlaps_bitmap[i] = 1;
11721172
}
11731173
return Status::Ok();
@@ -1311,13 +1311,12 @@ Status ArrayDirectory::is_fragment(
13111311
}
13121312

13131313
bool ArrayDirectory::consolidation_with_timestamps_supported(
1314-
const URI& uri) const {
1314+
const FragmentID& id) const {
13151315
// FragmentID::array_format_version() returns UINT32_MAX for versions <= 2
13161316
// so we should explicitly exclude this case when checking if consolidation
13171317
// with timestamps is supported on a fragment
1318-
FragmentID fragment_id{uri};
13191318
return mode_ == ArrayDirectoryMode::READ &&
1320-
fragment_id.array_format_version() >=
1319+
id.array_format_version() >=
13211320
constants::consolidation_with_timestamps_min_version;
13221321
}
13231322

tiledb/sm/array/array_directory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,10 @@ class ArrayDirectory {
827827
/**
828828
* Checks if consolidation with timestamps is supported for a fragment
829829
*
830-
* @param uri The fragment URI to be checked.
830+
* @param id The fragment ID to be checked.
831831
* @return True if supported, false otherwise
832832
*/
833-
bool consolidation_with_timestamps_supported(const URI& uri) const;
833+
bool consolidation_with_timestamps_supported(const FragmentID& id) const;
834834
};
835835

836836
} // namespace tiledb::sm

tiledb/sm/filesystem/uri.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ std::string URI::to_path() const {
420420
return to_path(uri_);
421421
}
422422

423-
std::string URI::to_string() const {
423+
const std::string& URI::to_string() const {
424424
return uri_;
425425
}
426426

tiledb/sm/filesystem/uri.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class URI {
319319
std::string to_path() const;
320320

321321
/** Returns the URI string. */
322-
std::string to_string() const;
322+
const std::string& to_string() const;
323323

324324
/** Returns the parent dir URI */
325325
URI parent_path() const;

tiledb/sm/fragment/fragment_identifier.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bool FragmentID::has_fragment_name(const URI& uri) {
120120
return name.find_last_of('_') != std::string::npos;
121121
}
122122

123-
FragmentID::FragmentID(const std::string_view& path)
123+
FragmentID::FragmentID(std::string_view path)
124124
: FragmentID(URI(path)) {
125125
}
126126

tiledb/sm/fragment/fragment_identifier.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class FragmentID {
9191

9292
public:
9393
/** Constructor. */
94-
FragmentID(const URI& uri);
94+
explicit FragmentID(const URI& uri);
9595

9696
/** Constructor. */
97-
FragmentID(const std::string_view& path);
97+
explicit FragmentID(const std::string_view path);
9898

9999
/** Destructor. */
100100
~FragmentID() = default;

0 commit comments

Comments
 (0)