React | Svelte | |
---|---|---|
Since | 2011 (before ES6) | 2016 (after ES6) |
Type | Library (slower) | Compiler (faster) |
Reactivity | Hooks, runtime | Plain variables, compile-time |
Virtual DOM (2 DOMs) | Yes | No |
Performance | Mostly ok, DOM diffing, easy to screw up | Very fast by default |
Memory usage | High | Low |
- Do you run a JVM inside a container on Kubernetes (or maybe OpenShift)?
- Do you struggle with REQUEST and LIMIT parameters?
- Do you know the impact of those parameters on your JVM?
- Have you met OOM Killer?
Hope you will find answers to these questions in this example-based article.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def text = "Going to convert this to Base64 encoding!" | |
// Encode | |
def encoded = text.bytes.encodeBase64().toString() | |
println encoded | |
// Decode | |
byte[] decoded = encoded.decodeBase64() | |
println new String(decoded) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tailrec fun <T : Comparable<T>> binarySearch(list: List<T>, item: T, startIndex: Int = 0, endIndex: Int = list.size - 1): Int { | |
if (endIndex < startIndex ) { | |
return -1 | |
} else if (startIndex == endIndex) { | |
return if (item == list[startIndex]) startIndex else -1 | |
} else if (endIndex == startIndex + 1) { | |
if (list[startIndex] == item) { | |
return startIndex | |
} | |
else if(list[endIndex] == item) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2015 Michael Rozumyanskiy | |
* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple groovy script to compress / decompress Strings | |
import java.util.zip.GZIPInputStream | |
import java.util.zip.GZIPOutputStream | |
def zip(String s){ | |
def targetStream = new ByteArrayOutputStream() | |
def zipStream = new GZIPOutputStream(targetStream) | |
zipStream.write(s.getBytes('UTF-8')) | |
zipStream.close() | |
def zippedBytes = targetStream.toByteArray() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger | |
import kotlin.math.plus | |
fun main(args: Array<String>) { | |
fibo().take(10).forEach { println(it.first) } | |
} | |
private fun fibo() = | |
stream(BigInteger.ZERO to BigInteger.ONE, {(e) -> | |
e.second to (e.first plus e.second) |
You can test with the iOS Simulator that comes with Xcode. Navigate to the Xcode app in the Finder, right click and select "Show Package Contents":
Then navigate to Contents > Applications, and open the shortcut to "iPhone Simulator" (it may be called "iOS Simulator" depending on which version of Xcode you're running):
NewerOlder