mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
optionally use lz4java for compression
This commit is contained in:
Generated
+11
@@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lz4-java">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/lz4-java-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/lz4-java-1.3-src.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Binary file not shown.
Binary file not shown.
+2
@@ -243,6 +243,8 @@ class CommunityLibraryLicenses {
|
||||
url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
|
||||
new LibraryLicense(name: "Lombok AST", libraryName: "lombok-ast", version: "0.2.1", license: "MIT", url: "http://projectlombok.org/",
|
||||
licenseUrl: "http://opensource.org/licenses/mit-license.php"),
|
||||
new LibraryLicense(name: "lz4-java", libraryName: "lz4-java", version: "1.3", license: "Apache 2.0", url: "https://github.com/lz4/lz4-java",
|
||||
licenseUrl: "https://github.com/lz4/lz4-java/blob/master/LICENSE.txt"),
|
||||
new LibraryLicense(name: "markdown4j", libraryName: "markdown4j-2.2", version: "2.2", license: "New BSD",
|
||||
url: "https://code.google.com/p/markdown4j/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
|
||||
new LibraryLicense(name: "markdownj", attachedTo: "tasks-core", version: "", license: "BSD", url: "https://github.com/myabc/markdownj",
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.util.io.URLUtil;
|
||||
import com.sun.jna.TypeMapper;
|
||||
import com.sun.jna.platform.FileUtils;
|
||||
import gnu.trove.THashSet;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import org.apache.log4j.Appender;
|
||||
import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.intellij.lang.annotations.Flow;
|
||||
@@ -515,6 +516,7 @@ public class PathManager {
|
||||
FileUtils.class, // JNA (jna-platform)
|
||||
PatternMatcher.class, // OROMatcher
|
||||
Snappy.class, // Snappy
|
||||
LZ4Factory.class, // Snappy
|
||||
};
|
||||
|
||||
final Set<String> classPath = new HashSet<String>();
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.intellij.openapi.util.ThreadLocalCachedByteArray;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import com.intellij.util.io.DataOutputStream;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import org.iq80.snappy.CorruptionException;
|
||||
import org.iq80.snappy.Snappy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -60,12 +62,22 @@ public class CompressionUtil {
|
||||
private static final AtomicLong mySizeAfterCompression = new AtomicLong();
|
||||
|
||||
public static final boolean DUMP_COMPRESSION_STATS = SystemProperties.getBooleanProperty("idea.dump.compression.stats", false);
|
||||
public static final boolean USE_SNAPPY = SystemProperties.getBooleanProperty("idea.use.snappy", true);
|
||||
|
||||
public static int writeCompressedWithoutOriginalBufferLength(@NotNull DataOutput out, @NotNull byte[] bytes, int length) throws IOException {
|
||||
long started = DUMP_COMPRESSION_STATS ? System.nanoTime() : 0;
|
||||
|
||||
final byte[] compressedOutputBuffer = spareBufferLocal.getBuffer(Snappy.maxCompressedLength(length));
|
||||
int compressedSize = Snappy.compress(bytes, 0, length, compressedOutputBuffer, 0);
|
||||
final byte[] compressedOutputBuffer;
|
||||
int compressedSize;
|
||||
|
||||
if (USE_SNAPPY) {
|
||||
compressedOutputBuffer = spareBufferLocal.getBuffer(Snappy.maxCompressedLength(length));
|
||||
compressedSize = Snappy.compress(bytes, 0, length, compressedOutputBuffer, 0);
|
||||
} else {
|
||||
LZ4Compressor compressor = LZ4Factory.fastestJavaInstance().fastCompressor();
|
||||
compressedOutputBuffer = spareBufferLocal.getBuffer(compressor.maxCompressedLength(length));
|
||||
compressedSize = compressor.compress(bytes, 0, length, compressedOutputBuffer, 0);
|
||||
}
|
||||
|
||||
final long time = (DUMP_COMPRESSION_STATS ? System.nanoTime() : 0) - started;
|
||||
mySizeAfterCompression.addAndGet(compressedSize);
|
||||
@@ -93,7 +105,13 @@ public class CompressionUtil {
|
||||
int decompressedRequests = myDecompressionRequests.incrementAndGet();
|
||||
long started = DUMP_COMPRESSION_STATS ? System.nanoTime() : 0;
|
||||
|
||||
byte[] decompressedResult = Snappy.uncompress(bytes, 0, size);
|
||||
final byte[] decompressedResult;
|
||||
|
||||
if (USE_SNAPPY) {
|
||||
decompressedResult = Snappy.uncompress(bytes, 0, size);
|
||||
} else {
|
||||
decompressedResult = LZ4Factory.fastestJavaInstance().fastDecompressor().decompress(bytes, 0, 32768);
|
||||
}
|
||||
|
||||
long doneTime = (DUMP_COMPRESSION_STATS ? System.nanoTime() : 0) - started;
|
||||
long decompressedSize = myDecompressedSize.addAndGet(size);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<orderEntry type="library" name="imgscalr" level="project" />
|
||||
<orderEntry type="library" name="xmlgraphics-commons" level="project" />
|
||||
<orderEntry type="library" name="batik" level="project" />
|
||||
<orderEntry type="library" name="lz4-java" level="project" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
Reference in New Issue
Block a user