/*
 * Copyright 2012-2016 JetBrains s.r.o
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jetbrains.jetpad.base;

public class Objects {
  /**
   * This method is added to replace com.google.common.base.Objects.equal(). The latter sometimes performs about 100 ms
   * on two equal 80K strings in Chrome 49.0.2623.87
   */
  public static boolean equal(Object o1, Object o2) {
    if (o1 == null) return o2 == null;
    if (o2 == null) return false;

    if (o1 instanceof String && o2 instanceof String) {
      String s1 = (String) o1;
      String s2 = (String) o2;
      if (s1.length() != s2.length()) return false;
      for (int i = 0; i < s1.length(); i++) {
        if (s1.charAt(i) != s2.charAt(i)) {
          return false;
        }
      }
      return true;
    }

    return o1.equals(o2);
  }
}
@@ -654,193 +654,8 @@
 s %7B%0A
-  /**%0A   * This method is added to replace com.google.common.base.Objects.equal(). The latter sometimes performs about 100 ms%0A   * on two equal 80K strings in Chrome 49.0.2623.87%0A   */%0A
   pu
@@ -777,17 +777,16 @@
  false;%0A
-%0A
     if (
@@ -792,324 +792,27 @@
 (o1 
-instanceof String && o2 instanceof String) %7B%0A      String s1 = (String) o1;%0A      String s2 = (String) o2;%0A      if (s1.length() != s2.length()) return false;%0A      for (int i = 0; i %3C s1.length(); i++) %7B%0A        if (s1.charAt(i) != s2.charAt(i)) %7B%0A          return false;%0A        %7D%0A      %7D%0A      return true;%0A    %7D%0A
+== o2) return true;
 %0A   

remove string comparison hack