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
public void process(ExecutorService executorService) { | |
long startTime = System.currentTimeMillis(); | |
try (ExecutorService executor = executorService) { | |
for (String url : getUrls()) { | |
executor.execute(() -> { | |
try { | |
new URL("https://" + url).getContent(); | |
System.out.println("Finished processing: " + url); | |
} catch (IOException e) { | |
} |
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
public class VirtualThread { | |
public static void main(String[] args) { | |
for (int i = 0; i < 1_000_000; i++) { | |
if (i%10_000 == 0) { | |
System.out.println(i); | |
} | |
Thread.startVirtualThread(() -> { | |
try { | |
Thread.sleep(Duration.ofMinutes(10).toMillis()); | |
} catch (Exception e) { |
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
public class PlatformThread { | |
public static void main(String[] args) { | |
for (int i = 0; i < 1_000_000; i++) { | |
if (i%10_000 == 0) { | |
System.out.println(i); | |
} | |
new Thread(() -> { | |
try { | |
Thread.sleep(Duration.ofMinutes(10).toMillis()); | |
} catch (Exception e) { |
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
Number of Items | Throughput | |
---|---|---|
25 | 5534.454 | |
1,000 | 122.58 | |
50,000 | 2.096 | |
250,000 | 0.376 | |
1,000,000 | 0.09 |
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
Java Version | Number of Items | Method | Throughput Ops/ms | |
---|---|---|---|---|
Java 17 | 25 | Group By | 1840.462 | |
Java 17 | 25 | Double Loop | 2432.982 | |
Java 8 | 25 | Group By | 2481.166 | |
Java 8 | 25 | Double Loop | 2370.741 | |
Java 17 | 1,000 | Group By | 55.222 | |
Java 17 | 1,000 | Double Loop | 47.378 | |
Java 8 | 1,000 | Group By | 78.105 | |
Java 8 | 1,000 | Double Loop | 59.908 | |
Java 17 | 50,000 | Group By | 1.09 |
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
Number of Items | Method | Throughput Ops/ms | |
---|---|---|---|
25 | Group By | 1741.89 | |
25 | Double Loop | 2337.535 | |
1,000 | Group By | 54.75 | |
1,000 | Double Loop | 77.319 | |
50,000 | Group By | 1.085 | |
50,000 | Double Loop | 0.963 | |
250,000 | Group By | 0.167 | |
250,000 | Double Loop | 0.14 | |
1,000,000 | Group By | 0.041 |
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
private static boolean verifyPassword(String realPassword, String providedPassword) { | |
if (realPassword.length() != providedPassword.length()) { | |
return false; | |
} | |
int result = 0; | |
for (int i = 0; i < realPassword.length(); i++) { | |
result |= realPassword.charAt(i) ^ providedPassword.charAt(i); | |
} |
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
private static boolean verifyPassword(String realPassword, String providedPassword) { | |
if (realPassword.length() != providedPassword.length()) { | |
return false; | |
} | |
for (int i = 0; i < realPassword.length(); i++) { | |
if (realPassword.charAt(i) != providedPassword.charAt(i)) { | |
return false; | |
} | |
} |
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 lambda_handler(event, context): | |
for record in event['Records']: | |
try: | |
bucket_name = record['s3']['bucket']['name'] | |
object_name = record['s3']['object']['key'] | |
object_size = record['s3']['object']['size'] | |
version_id = record['s3']['object']['versionId'] | |
# Key's come HTML encoded, we need to remove that. | |
object_name = urllib.parse.unquote_plus(object_name) |
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
service: s3objectlowercaser | |
provider: | |
name: aws | |
runtime: python3.8 | |
region: us-west-2 | |
environment: | |
FAILURE_QUEUE_NAME: | |
Fn::GetAtt: | |
- FailedLowerCasingObject |
NewerOlder