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
<?php | |
// Add this to your Divi child theme' functions.php file | |
// Remember to add the my_divi_fast_gallery class to all the galleries you want to optimize | |
add_filter('do_shortcode_tag', 'fast_gallery_tip', 105, 2); | |
function fast_gallery_tip($output, $tag){ | |
if('et_pb_gallery' === $tag && strpos($output, 'my_divi_fast_gallery') !== false){ | |
$pattern = '/<img[^>]*>/'; | |
$index = 0; | |
return preg_replace_callback($pattern, function($matches) use (&$index) { |
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 static double comparison(int desiredSize, int bufferSize){ | |
int size = desiredSize / bufferSize * bufferSize; | |
byte data[] = new byte[size]; | |
new Random().nextBytes(data); | |
long startTime = 0; | |
long endTime = 0; | |
int nRounds = 10; | |
double elapsed = 0; | |
for(int round = 0; round < nRounds; round++){ | |
MessageDigest sha = MessageDigest.getInstance("SHA-256"); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.