docs: @SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:returncount"})
      public static long estimateValueCost(Object value) {
          if (value == null) {
              return 0;
          }
          Class<?> clazz = value.getClass();
  
          Integer cost = KNOWN_FINAL_CLASSES_COSTS.get(clazz);
          if (cost != null) {
              return cost;
          }
  
          if (value instanceof String) {
              return BASE_STRING_COST + ((String) value).length() * 2L;
          }
  
          if (value instanceof Timestamp) {
              return SQL_TIMESTAMP_COST;
          }
  
          if (value instanceof Date) {
              return DATE_COST;
          }
  
          if (clazz.isEnum()) {
              // enum values are shared, so they don't cost anything
              return 0;
          }
  
          if (value instanceof BigDecimal) {
              return ROUGH_BIG_DECIMAL_COST;
          }
  
          if (value instanceof BigInteger) {
              return ROUGH_BIG_INTEGER_COST;
          }
  
          return ROUGH_UNKNOWN_CLASS_COST;
      }