Filter
Exclude
Time range
-
Near
Replying to @KooKiz
There’s a StringPool class in the Microsoft.Toolkit.HighPerformance.dll library, in the Buffers namespace. Also, you might want to create a ValueStringBuilder class that’s a ref struct. U can find one online, or I can send you mine. Look in the DefaultStringInterpolation class
100
Replying to @ChShersh
#include <ankerl/unordered_dense.h> // Assuming this is the include for ankerl::unordered_dense #include <optional> #include <string_view> #include <cstddef> // Assuming StringPool, internal::check, ErrorCode, TRACE, and log::version are defined elsewhere. class ColumnMap { ankerl::unordered_dense::map<std::string_view, size_t> column_offsets_; StringPool pool_; public: ColumnMap(size_t size) : column_offsets_(size) {} void insert(std::string_view name, size_t index) { // Check for duplicate name to prevent accidental overwrites if (column_offsets_.contains(name)) { internal::check<ErrorCode::E_INVALID_ARGUMENT>( false, "Column with name '{}' already exists", name ); } auto off_str = pool_.get(name); auto view = pool_.getView(off_str.offset()); column_offsets_[view] = index; // Use operator[] for insertion } void erase(std::string_view name) { auto it = column_offsets_.find(name); internal::check<ErrorCode::E_INVALID_ARGUMENT>( it != column_offsets_.end(), "Cannot drop column with name '{}' as it doesn't exist", name ); auto dropped_offset = it->second; column_offsets_.erase(it); // Shift offsets greater than dropped_offset for (auto& [_, offset] : column_offsets_) { if (offset > dropped_offset) { --offset; } } } std::optional<size_t> column_index(std::string_view name) const { auto it = column_offsets_.find(name); if (it != column_offsets_.end()) { return it->second; } else { TRACE( log::version(), "Column {} not found in map of size {}", name, column_offsets_.size() ); return std::nullopt; } } // Optional additions for robustness (comment out if not needed) size_t size() const { return column_offsets_.size(); } // Validate that indices are dense (0 to size()-1) with no duplicates or gaps void validate_indices() const { std::unordered_set<size_t> seen; for (const auto& [_, offset] : column_offsets_) { internal::check<ErrorCode::E_INTERNAL>( offset < column_offsets_.size() && seen.insert(offset).second, "Invalid column indices: duplicates or gaps detected" ); } } };
38
Replying to @javarevisited
Two, one in the StringPool and after that, it creates another one in the heap thanks to the "new" operator.
140
Replying to @Punita_Tech
Well when you assign String s = "sky"; This object is created in the stringpool of method area. And that variable pointing to the same object reference.
2
199
15 Jun 2025
fn (&mut StringPool, RefCountString) -> RefCountString な関数を作りたいのだが良い関数名が思い付かず、仮で get_smarter() とかいう馬鹿みたいな名前にしている
119
Good Night, Java Devs! 🌙💻 Did you know? Java optimizes memory with the String Pool! Using String s = "Java"; reuses memory, while new String("Java") creates a new object. Sleep well & let the Garbage Collector do its job! 💤🗑️ #Java #StringPool #GoodNightCoders 🚀
3
12
652